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 php session_start() and session_destroy() function?
What is the use of anonymous function in php?
What would occur if a fatal error was thrown in your php program?
What is string in php?
What are the methods useful for method overloading?
Which function would you use to merge two arrays in php?
How to create connection in php?
Is facebook still written in php?
What is the meaning of php?
What is the difference between for and foreach?
Steps for the payment gateway processing?
How do I display php errors?
Tell me how comparison of objects is done in php5?
What is the difference between query and question?
What is strlen function in php?