Online help! A question about downloading files. could you help the girl ~~ & Lt ;? Success; $ file_dir & nbsp; $ title & nbsp; & Online Help! A question about downloading files. could you help the girl ~~
$ File_name = 'http: // response ';
$ File_dir = '';
$ Title = 'download ringtones ';
$ Title = str_replace ('\ '','', $ title );
$ Rename = 'rename' .'_'.{title ';
If (! File_exists ($ file_dir. $ file_name) {// check whether the file exists
Echo" File does not exist ";
Exit;
} Else {
// Below is the focus of PHP file download
Header ("Content-type: application/octet-stream ");
Header ("Accept-Ranges: bytes ");
Header ("Content-Type: application/force-download"); // force the browser to download
Header ("Content-Disposition: attachment; filename = \" ". $ rename." \ ""); // rename the file
Header ("Accept-Length:". filesize ($ file_dir. $ file_name); // file size
// Read the file content
@ Readfile ($ file_dir. $ file_name); [email protected]
}
?>
The problem I have now is that I want to download a remote mp3 file through the file in the code above, but it always fails and always prompts that the file does not exist.
However, if I delete the if judgment, it can be downloaded, but the downloaded files are all bad (not the actual path file)
------ Solution --------------------
Your code is feasible. remove the if judgment section. Wait until it is finished.
------ Solution --------------------
Filesize does not support remote file Detection. only one function is file_get_contents ().