How to download the files using PHP
Answer / 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 |
What is MVC structure in Magento?
can any one tell how to install LAMP server in terminal in ubuntu.....and also tell please how to run php files in ubunut and how to save and compile in ubuntu..i already installed ubuntu ..but i dont installed lamp server so i want to install lamp server in terminal is it possible please reply
What does nan stand for computer science?
Tell me what does the array operator '===' means?
What are the limitations or drawbacks of PHP ?
Difference between get and post method.
How can we get the properties (size, type, width, height) of an image using PHP image functions?
Explain array_uintersect()?
what is the default method of form in php?
What is difference between echo and print in php?
1.What are the difference between echo , print , print_r ? else this 3 can we show output to a client in some other way?
Do you know how to delete a file from the system?