Jump to content

[SOLVED] Forcing download dialog


pedjasmek

Recommended Posts

I'm using this code to force browser's download dialog.I have problem only with IE 6 because the downloaded file size is 0 bytes.Does anyone know why?

$fp=fopen('c:\xampp\htdocs\pesme\R.E.M.-Losing_My_Religon.mp3','r');
$name=basename("c:\xampp\htdocs\pesme\R.E.M.-Losing_My_Religon.mp3");
$size=filesize('c:\xampp\htdocs\pesme\R.E.M.-Losing_My_Religon.mp3');
header('pragma: cache');
header('pragma: public'); 
header('Content-Type: audio/mpeg');
header('Content-Length:$size');
header("Cache-Control: private",false);
header('Cache-Control: max-age=0'); 
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment;filename= $name");
fpassthru($fp);
fclose($fp);

Link to comment
https://forums.phpfreaks.com/topic/76752-solved-forcing-download-dialog/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.