Jump to content

Force Download problems


dennismonsewicz

Recommended Posts

header('Content-Description: File Transfer');
		    header('Content-Type: application/octet-stream');
		    header('Content-Disposition: attachment; filename='.basename("/tmp/mytest.xls"));
		    header('Content-Transfer-Encoding: binary');
		    header('Expires: 0');
		    header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
		    header('Pragma: public');
		    header('Content-Length: ' . filesize("/tmp/mytest.xls"));
		    readfile("/tmp/mytest.xls");

 

The code above does not force download the file, rather it displays the results on the screen... is this a problem of the headers not sending?

Link to comment
https://forums.phpfreaks.com/topic/184789-force-download-problems/
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.