Unknown file type MIME?
You can use application/octet-stream for unknown types. RFC 2046 states in section 4.5.1: The “octet-stream” subtype is used to indicate that a body contains arbitrary binary data.
You can use application/octet-stream for unknown types. RFC 2046 states in section 4.5.1: The “octet-stream” subtype is used to indicate that a body contains arbitrary binary data.
Your problem As far as I can see, it looks like the way you create the message and everything is mostly right! You use the right MIME types and everything. I am not sure why you use a DataSource and DataHandler, and have a ContentID on the image, but you need to complete your question … Read more
No, image/jpg is not the same as image/jpeg. You should use image/jpeg. Only image/jpeg is recognised as the actual mime type for JPEG files. See https://www.rfc-editor.org/rfc/rfc3745, https://www.w3.org/Graphics/JPEG/ . Serving the incorrect Content-Type of image/jpg to IE can cause issues, see http://www.bennadel.com/blog/2609-internet-explorer-aborts-images-with-the-wrong-mime-type.htm.
The method is not deprecated! It once was incorrectly marked as deprecated in the manual, but it has been fixed https://bugs.php.net/bug.php?id=71367 on the 14th of January 2016. However, at the moment, it is still incorrectly marked deprecated in the German, Spanish and Chinese manual. Feel free to use mime_content_type() whenever you like :).
edwardxu’s solution works perfectly for me. Just to clarify a bit: PackageManager packageManager = getActivity().getPackageManager(); if (intent.resolveActivity(packageManager) != null) { startActivity(intent); } else { Log.d(TAG, “No Intent available to handle action”); }
For JSON text: application/json The MIME media type for JSON text is application/json. The default encoding is UTF-8. (Source: RFC 4627) For JSONP (runnable JavaScript) with callback: application/javascript Here are some blog posts that were mentioned in the relevant comments: Why you shouldn’t use text/html for JSON Internet Explorer sometimes has issues with application/json A rather … Read more
To quote from the RFC 1341, section 7.2.1, what I consider to be the relevant bits on the boundary parameter of the Content-Type header (for MIME): All subtypes of “multipart” share a common syntax … The Content-Type field for multipart entities requires one parameter, “boundary”, which is used to specify the encapsulation boundary. The encapsulation … Read more
You will have to write your InputStream to your response OutputStream as follows: Your Content-Disposition will have to be inline. Your Content-Type will have to be application/pdf. Your Content-Length will be the length (in bytes) of the total data in the InputStream. Once set, write the input stream data to output stream of the response. … Read more
UPDATE: @GetoX has taken this code and wrapped it in a NuGet package for .net core! See below, cheers!! So I was wondering if anyone could point me to another method with more MIME types, or alternatively another method / class were I would be able to include the MIME types I see fit. I … Read more
Yes, it’s just an IIS setting: by default, it will only serve files for which the extension matches a defined MIME type. To allow .docx files to be downloaded, follow the steps from the KB article linked above: Open the IIS Microsoft Management Console (MMC), right-click the local computer name, and then click Properties. Click … Read more