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 |
How can I find the colour of a pixel of an image?
2 Answers Rushmore Consultancy,
What is overloading and overriding in oop?
Why and where do we use htaccess?
How to create a table using php?
What is the function of string in c?
What is string function sql?
Explain me what is the w3c?
What is PHP's configuration file called?
How to create an array in php?
Explain the syntax for ‘foreach’ loop with example.
What is empty php?
Explain some of the php string functions?