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 are the encryption techniques in php?
Is age interval or ordinal data?
how can i get USA time using php...
Explain what is the main difference between require() and require_once()?
What is ci in php?
How can we enable error reporting in php?
Does php pass arrays by reference?
What is api used for?
What's the best method for sanitizing user input with php?
Difference between array_combine and array_merge?
How to call php function in jquery?
Can I use node js with php?