Dealing with inconsistent or corrupt character encodings Dealing with inconsistent or corrupt character encodings. ISO 8859-1 also known as Latin-1, or UTF-8) cause any problems. Unfortunately, there does not exist any gold standard for encodings. The closest to such a gold standard, particularly for western languages, is UTF-8. Application Octet StreamApplication/octet-stream Utf 8In times like these, the official HTTP specification is always helpful. From (my emphasis added): Any HTTP/1.1 message containing an entity-body SHOULD include a Content-Type header field defining the media type of that body. 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. If the media type remains unknown, the recipient SHOULD treat it as type 'application/octet-stream'. Application/octet-stream Utf8The cause of your issue is that the server accepting the file upload does not itself know what type of file has been uploaded. Jai shri krishna meaning. 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 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. 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. Now, when we consider this in conjunction with the, we see the following: $_FILES['userfile']['type'] The mime type of the file, if the browser provided this information. An example would be 'image/gif'.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |