note 82597 added to function.readfile
| From: | saidketchman at gmail dot com | Date: | Thu, 17 Apr 2008 19:19:21 +0000 |
| Subject: | note 82597 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138418@lists.php.net to get a copy of this message | ||
I'm having an issue with browers except FireFox 2.
I'm trying to use my download script to download from external URLs. Firefox handles it fine
and downloads the file but Internet Explorer 7 and Safari 2 only download a placeholder (empty)
file.
Any ideas why I can't handle the external URLs? I can swear it was working fine before but
then out of no where a user emailed me saying it wasn't working anymore.
This is my code (with a bunch of headers added from posts here):
# Set Format Type
if ($audioformat == "wma")
{
header('Content-type: audio/x-ms-wma');
}
else if ($audioformat == "mp3")
{
header('Content-type: audio/mpeg');
}
$fullpath = $audiopath .$artist. '/' .$filename;
# header info for download
header('Content-Length: ' . filesize($fullpath));
header('Content-Disposition: attachment; filename="' . $filename.
'"');
header('Content-Transfer-Encoding: binary');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Expires: 0');
header('Content-Description: Quran Download');
ob_clean();
flush();
# begin download
readfile($fullpath) or die("error!");
exit;
----
Server IP: 64.71.164.2
Probable Submitter: 69.216.99.169
----
Manual Page -- http://www.php.net/manual/en/function.readfile.php
Edit -- https://master.php.net/note/edit/82597
Del: integrated -- https://master.php.net/note/delete/82597/integrated
Del: useless -- https://master.php.net/note/delete/82597/useless
Del: bad code -- https://master.php.net/note/delete/82597/bad+code
Del: spam -- https://master.php.net/note/delete/82597/spam
Del: non-english -- https://master.php.net/note/delete/82597/non-english
Del: in docs -- https://master.php.net/note/delete/82597/in+docs
Del: other reasons-- https://master.php.net/note/delete/82597
Reject -- https://master.php.net/note/reject/82597
Search -- https://master.php.net/manage/user-notes.php