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 get method in java?
List some features of php that are deprecated in php7?
Is string php function?
What language is php written in?
Explain some most commonly use string functions in php?
What is the use of $_server and $_env?
What is design pattern? Explain all including singleton pattern?
How to get ip address of clients machine?
How to get the value of current session id?
Do I need to install php after xampp?
How to return a value back to the function caller?
What does a dependant variable mean?
What is the difference between runtime exception and compile time exception?
What is the use of limit in mysql?
Explain what is memcache?