มีประเภท MIME“ เริ่มต้น” หรือไม่


คำตอบ:


197

The least specific official MIME type is application/octet-stream. Without any additional information, it says "here is a bunch of bytes, hopefully there is an application over on your end which knows what to do with them". Sometimes there is a file name which helps convey to the recipient what to do with the data.

"unknown" doesn't really add anything over this, except to confuse clients who don't support random unofficial MIME types. Ditto for application/binary; it's just a non-standard way of restating "octet-stream".

This is the answer to "What can I put in the Content-Type: header if I can't find an existing content type which adequately describes my data?" which is how I have interpreted this question. The proposed duplicate Unknown file type MIME? has a lengthy answer which discusses "How is my data interpreted if I don't put a valid Content-Type: header?" specifically in an HTTP context; the answer to that is protocol-specific (in email, for example, the default implied Content-Type: for MIME body parts which do not contain this header is text/plain; charset="us-ascii").


You're wrong. IETF says default is no content type. read more carrefully your link
FF_Dev

@FF_Dev Not sure what you mean. Are you saying Sampo's link to his own answer is wrong? Or that my answer is wrong? Or something else?
tripleee

@tripleee His answer says "Do not send MIME type for unknown data." which is different than this answer. So either his comment is irronical, either it is wrong. It deserved to be highlighted
FF_Dev

tripleee & @FF_Dev I think that my answer was not phrased clearly enough and TLDR part was a bit confusing as I did not made it completely clear what you should leave out when dealing with unknown stuff.
Sampo Sarrala - codidact.org

4
@SampoSarrala The answer talks about HTTP specifically, though; MIME has many applications, many of which may be governed by other specifications, or none at all. A specific counter-example is email, where omitting the content type implies text/plain, for backwards compatibility.
tripleee
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.