Php force-download failed reading url
Posted: Fri Sep 23, 2005 12:28 am
I have recently migrated my webserver to linux and in the process readfile does not work for urls anymore. I have a file called forcedownload.php which takes $filename and $name and downloads the filename url with the desired name. it looks like
The resulting file only contains the following errors:
The url is valid and once again this worked on my previous windows instillation perfectly.
Code: Select all
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"".$name."\";" );
header("Content-Transfer-Encoding: binary");
readfile("$filename");
exit();Code: Select all
<b>Warning</b>: readfile() [<a href='function.readfile'>function.readfile</a>]: php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>/opt/lampp/htdocs/forcedownload.php</b> on line <b>15</b>
<b>Warning</b>: readfile(http://xpc/12-i_wayne-living_in_love-jah.mp3) [<a href='function.readfile'>function.readfile</a>]: failed to open stream: Resource temporarily unavailable in <b>/opt/lampp/htdocs/forcedownload.php</b> on line <b>15</b>