"Juan Germano" <[EMAIL PROTECTED]> wrote in message
004b01c081f3$46be8160$ddf90dd1@juangerm">news:004b01c081f3$46be8160$ddf90dd1@juangerm...
> 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);
Try this, only change your fread line like so:
echo fread($fp,filesize($filename));
I have to do this to put out an image with a image/vnd.wap.wbmp header, and
it works for me.
--
Rick Hodger
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]