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
What is the use of callback in php?
What is Type hinting in PHP?
What is the difference between single quoted string and double quoted string?
Tell me what kind of things have you done on the social side?
In php how can you jump in to and out of "php mode"?
What is alias in php?
Which is better php or nodejs?
What is use of echo in php?
Describe which programming language does php parallel to?
How do you create an array in php?
What is the difference between get & post ?
Does cors prevent csrf?
Do loops php?
How can we access the data sent through the url with the get method?
Is null empty php?