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
[EMAIL PROTECTED]
--
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]