Re: Downloads, headers and binary data
| From: | jeremy brand | Date: | Fri, 19 Jan 2001 08:37:13 +0000 |
| Subject: | Re: Downloads, headers and binary data | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-35587@lists.php.net to get a copy of this message | ||
your script is probably timing out.
Try doing:
set_time_limit(0);
at the top of your script.
Jeremy
Jeremy Brand :: Sr. Software Engineer :: 408-245-9058 :: jeremy@nirvani.net
http://www.JeremyBrand.com/Jeremy/Brand/Jeremy_Brand.html
for more
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"LINUX is obsolete" -- Andy Tanenbaum, January 29th, 1992
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
http://www.JEEP-FOR-SALE.com/ -- I need a buyer
Get your own Free, Private email at http://www.smackdown.com/
On Fri, 19 Jan 2001, Juan Germano wrote:
> Date: Fri, 19 Jan 2001 05:38:48 -0300
> From: Juan Germano <droctulft@yifan.net>
> To: php-general@lists.php.net
> Subject: [PHP] Downloads, headers and binary data
>
> Hi. I'm trying to write a script to download a mp3 file. I did this:
>
> $filesize=filesize($filename);
> header("Content-disposition: attachment;filename=".basename($filename));
> header("Content-type: application/octetstream");
> header("Content-Transfer-Encoding: binary");
> header("Pragma: no-cache");
> header("Expires: 0");
> header("Content-Length: $filesize");
> readfile($filename,$filesize);
>
> I began with the first two headers but the problem is that the script works
> fine with
> text files but I get shorter files than the originals with mp3s, so I added
> the rest trying to solve the problem.
> So I tryied
>
> $fp=fopen($filename,"r");
> fread($fp,filesize($filename));
> fclose($fp);
>
> and
>
> $fp=fopen($filename,"r");
> fpassthru($fp);
>
> None of above worked.
> But I tryied using the php.exe and I got exactly what I want.
> So, perhaps it is a problem with the headers. I tryied both Netscape and IE,
> and also diferents content-type (audio/mpeg).
> Anyone has ideas?
>
> Juan Germano
> droctulft@yifan.net
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>