Page 1 of 1
Downloading with header()
Posted: Fri Dec 20, 2002 2:50 pm
by Xgtx
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.
Posted: Fri Dec 20, 2002 10:32 pm
by evilcoder
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.
Re: Downloading with header()
Posted: Mon Dec 23, 2002 3:38 am
by Peter A. Shushpanov
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.
Why you are using "Content-type: application/octet-stream"?
Try "Content-Type: application/xgt". IMHO it works much better
