Downloading with header()
Moderator: General Moderators
Downloading with header()
I am trying to use the header() function to have users download a file. It is a binary file (extention: xgt - a custom one from my company), and I am using content-type: application/octet-stream. The download begins, but incorrectly. IE appends .htm to the file (file.xgt.htm), and Netscape/Mozilla append .php. Does anyone know how to work around this? I used to have the files zipped, which worked fine, but my boss has told me that he no longer wants the users to download a zip file.
Sorry about a bit of a dud response, but you could try making a page which just displays a link to the file and a bit of text that says
(Right Click and Choose Save File As)
i will look into PHP's ability to force downloading, but i'm not sure at the moment, sorry thats the best i could think of. Maybe tell your boss that .zip is the most effective way to allow downloads.
(Right Click and Choose Save File As)
i will look into PHP's ability to force downloading, but i'm not sure at the moment, sorry thats the best i could think of. Maybe tell your boss that .zip is the most effective way to allow downloads.
-
Peter A. Shushpanov
- Forum Newbie
- Posts: 4
- Joined: Mon Dec 23, 2002 3:38 am
- Location: Russia
- Contact:
Re: Downloading with header()
Why you are using "Content-type: application/octet-stream"?Xgtx wrote:I am trying to use the header() function to have users download a file. It is a binary file (extention: xgt - a custom one from my company), and I am using content-type: application/octet-stream. The download begins, but incorrectly. IE appends .htm to the file (file.xgt.htm), and Netscape/Mozilla append .php. Does anyone know how to work around this? I used to have the files zipped, which worked fine, but my boss has told me that he no longer wants the users to download a zip file.
Try "Content-Type: application/xgt". IMHO it works much better