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
Do you know what is use of count() function in php?
How big is nvarchar max?
can you give me an example code of calling java script function in php variable using AJAX.or with out ajax??????
Write a program to display a table of any given number?
What is config file in php?
Are react hooks stable?
How to calculate the length of a string?
What is default session time and path in PHP. How to change it?
How can you upload a file using php?
Explain the advantages of using PHP?
how can i develop forum code? any one pleale help me on this question
How to download file in php?
Write a program in php to find the occurrence of a word in a string?
What are the differences between php3 and php4 and php5? What is the current stable version of php? What advance thing in php7?
How come the code works, but doesn’t for two-dimensional array of mine?