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
How to redirect https to http url through .htaccess?
What is $_ request in php?
Which cryptographic functions in php returns the longest hash value?
What is isset function in php?
Does php support polymorphism?
Does php support function overloading?
What is Gd PHP?
Tell me what sized websites have you worked on in the past?
What is the value for this auto incremented field user_pri_id?
How do you clear environment variables?
Can you convert php to html?
What is php dependency injection?
What is form action php?
What is difference between readonly and constant?
What software is required for php?