restscale.blogg.se

Python convert image format in stream mime
Python convert image format in stream mime







python convert image format in stream mime

The mime type of the file, if the browser provided this information.

#Python convert image format in stream mime manual#

Now, when we consider this in conjunction with the PHP manual entry regarding POST file uploads docs, we see the following: It's also possible that the client uploading the file opted not to determine the mime type of the file it was uploading and sent the Content-Type: application/octet-stream header itself.

python convert image format in stream mime

The browser has likely not sent a Content-Type header and the server has assumed application/octet-stream as per the official HTTP specification excerpt above. Why? Because it relies on the the HTTP message which sent the file to specify a Content-Type header to determine the exact mime-type. The cause of your issue is that the server accepting the file upload does not itself know what type of file has been uploaded. If the media type remains unknown, the recipient SHOULD treat it as type "application/octet-stream". If and only if the media type is not given by a Content-Type field, the recipient MAY attempt to guess the media type via inspection of its content and/or the name extension(s) of the URI used to identify the resource. From RFC 2616 7.2.1 (my emphasis added):Īny HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. In times like these, the official HTTP specification is always helpful.









Python convert image format in stream mime