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 x+ mode in fopen() used for?
how to open & closing opening period in fico
Can php run without server?
How to remove values saved in the current session?
What is the difference between InnoDB and MyIsam
1 Answers Brain Technosys, IBM, TCS, TLI Software, Wipro,
Explain about the $_GET variable of PHP?
How many ways there are to fetch the data from the Database?
How to get ip address of a server in php?
How to use the COM components in PHP?
Is uploaded file php?
This question is regarding version control. If two developers are committing the same php file at same time what will happen ? What error it will show (if any) ?
What is the difference between nowdoc and heredoc?