Jump to content

Downloading a file using header


c_shelswell

Recommended Posts

Hi,

 

I'm trying to get a page to work to download a file using the header function. It works great if you just click the link but if you right click 'save target as' (only in firefox for some reason) it trys to download the page i'm using to redirect to the file. Is there a way of stopping this?

 

This is what i have at the moment:

Header('Content-Type: application/zip');
header('Content-Disposition: attachment; filename="'.$filename.'"');
Header("Location: " . $downloadURL . $string . "/" . $filename);

Link to comment
https://forums.phpfreaks.com/topic/93532-downloading-a-file-using-header/
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.