Answer Posted / vishwapati_mishra
<?
$dir="/path/to/file/";
if (isset($_REQUEST["file"])) {
$file=$dir.$_REQUEST["file"];
header("Content-type: application/force-download");
header("Content-Transfer-Encoding: Binary");
header("Content-length: ".filesize($file));
header("Content-disposition: attachment;
filename=\"".basename($file)."\"");
readfile("$file");
} else {
echo "No file selected";
}
?>
| Is This Answer Correct ? | 7 Yes | 2 No |
Post New Answer View All Answers
Is php dying 2018?
How can we make a constant in php?
How can we submit form without a submit button?
Where is session id stored?
What type of errors can be occurred in php?
Which php framework is best for web development?
What is abstraction php?
What is array filter in php?
Distinguish between urlencode and urldecode?
What does empty mean in php?
Where are cookies stored php?
What is the main difference between require() and require_once()?
Explain what are psrs? Choose 1 and briefly describe it?
Is wordpress a php framework?
Is php a mvc?