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 the use of friend function?
Tell me what is mean by an associative array?
How error handling is being handled by php?
write the function to fetch a image from mysql databases (datatype blob).
How is it possible to cast types in php?
What is the $_ server php_self variable?
I need to know about the courses which are useful in corporate companies.. especially php/mySQL, Java/j2ee, .NET.. also tell if any other courses are valuable
What is a controller in php?
What is the use of post in php?
How can I make a script that can be bilanguage (supports English, German)?
What are php functions?
Why do we use hooks?