Which MIME type to use as a general purpose?

I have a PHP script that I use to download various types of files (PDF, JPEG, RAR end other). Works great, however, I noticed a problem with the MIME type.

Is there a universal MIME type that I can safely use for "general purpose"? I am thinking of an application / octet stream for all file types.

Or should I do MIME for each file type separately?

It should deliver downloads, it does not matter directly open files in applications.

+7
mime-types
source share
1 answer

If you just want to deliver files and donโ€™t care about the type of application needed to open it, then itโ€™s safe to specify the mime file type as application/octet-stream . However, you must indicate that it should be saved and should not be attempted to open inside the browser.

you must specify the header as: Content-Type: application/octet-stream Content-Disposition: attachment; filename="file.png" Content-Type: application/octet-stream Content-Disposition: attachment; filename="file.png"

It tells the browser (or client application) that the file should be downloaded and should not be opened in a line.

+2
source share

All Articles