Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

header('Content-Type: - Explained 2

Status
Not open for further replies.

k4ghg

Technical User
Dec 25, 2001
191
US
Could someone please tell me the difference between the two statements below. I want users to download a file after they select a download button without going through additional steps. Thanks...

header('Content-Type: application/force-download');
header('Content-Type: application/octet-stream');
 
Hi

For now this is not really a PHP question.

Regarding the registered MIME types ( for example application/octet-stream ), see MIME Media Types on IANA's site.

Regarding the unregistered MIME types ( for example application/force-download ), there is no official documentation.

application/force-download is similar to application/k4ghg-says-download-me : both are unregistered, incorrect and valid.

Some people used to include multiple [tt]Content-type[/tt] headers. That is useless, only one ( usually the last specified ) will be sent to the browser.
k4ghg said:
I want users to download a file after they select a download button without going through additional steps.
Do not want. It is not your machine, so there will happen what the visitor wants. And if he/she configured the browser to do something specific with the files of the given type, you can do nothing against it.

You can however send out unregistered or even invalid MIME type in the [tt]Content-type[/tt] header, hoping the visitor's browser will not know it.

Feherke.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top