2,042 questions
592
votes
25
answers
463k
views
Detect when a browser receives a file download
I have a page that allows the user to download a dynamically-generated file. It takes a long time to generate, so I'd like to show a "waiting" indicator. The problem is, I can't figure out ...
508
votes
30
answers
551k
views
Get MIME type from filename extension
How can I get the MIME type from a file extension?
457
votes
6
answers
632k
views
Setting mime type for excel document
MS Excel has the following observed MIME types:
application/vnd.ms-excel (official)
application/msexcel
application/x-msexcel
application/x-ms-excel
application/x-excel
application/x-dos_ms_excel
...
393
votes
28
answers
543k
views
How to get a file's Media Type (MIME type)?
How do you get a Media Type (MIME type) from a file using Java? So far I've tried JMimeMagic & Mime-Util. The first gave me memory exceptions, the second doesn't close its streams properly.
How ...
317
votes
4
answers
294k
views
Which MIME type to use for a binary file that's specific to my program?
My program uses its own binary file type, so I assume I can't use MIME type text/plain, as it is not a 7-bit ASCII file.
Should I just call it "application/myappname"?
283
votes
19
answers
322k
views
How to find the mime type of a file in python?
Let's say you want to save a bunch of files somewhere, for instance in BLOBs. Let's say you want to dish these files out via a web page and have the client automatically open the correct application/...
275
votes
19
answers
303k
views
Using .NET, how can you find the mime type of a file based on the file signature not the extension
I am looking for a simple way to get a mime type where the file extension is incorrect or not given, something similar to this question only in .Net.
265
votes
14
answers
237k
views
Proper MIME type for OTF fonts
Searching the web, I find heaps of different suggestions for what the proper MIME type for a font is, but I have yet to try any MIME type that rids me of a Chrome warning such as the following:
...
200
votes
10
answers
217k
views
Mail multipart/alternative vs multipart/mixed
When creating email messages you are supposed to set the Content-Type to multipart/alternative when sending HTML and TEXT or multipart/mixed when sending TEXT and attachments.
So what do you do if ...
194
votes
8
answers
207k
views
How can I find out a file's MIME type (Content-Type)?
Is there a way to find out the MIME type (or is it called "Content-Type"?) of a file in a Linux bash script?
The reason I need it is because ImageShack appears to need it to upload a file, ...
184
votes
14
answers
631k
views
embedding image in html email
I'm trying to send a multipart/related html email with embedded gif images. This email is generated using Oracle PL/SQL. My attempts have failed, with the image showing up as a red X (in Outlook ...
184
votes
17
answers
379k
views
Resource blocked due to MIME type mismatch (X-Content-Type-Options: nosniff)
I am developing a web page using JavaScript and HTML, everything was working
good when I have received this list of errors from my HTML page:
The resource from “https://raw.githubusercontent.com/...
183
votes
3
answers
103k
views
Unknown file type MIME?
Do I have to specify a MIME type if the uploaded file has no extension?
In other words is there a default general MIME type?
173
votes
11
answers
121k
views
YAML media type?
What is the most appropriate media type (formally MIME type) to use when sending data structured with YAML over HTTP and why?
There is no registered application type or text type that I can see.
...
172
votes
5
answers
67k
views
What is the MIME type for Markdown?
Does anyone know if there exists a MIME type for Markdown? I guess it is text/plain, but is there a more specific one?
150
votes
1
answer
77k
views
Is there a "default" MIME type?
Is there what could be considered a "default" mimetype?
I've seen "unknown/unknown" and "application/binary". But is there a default to revert to when no other MIME type is found?
130
votes
17
answers
253k
views
Nginx fails to load CSS files
I've recently decided to switch from Apache2 to Nginx. I installed Nginx on my CentOS server and setup a basic configuration.
When I tried to load my site in browser (FF/Chrome) I noticed that css ...
128
votes
5
answers
209k
views
How to use the CSV MIME-type?
In a web application I am working on, the user can click on a link to a CSV file. There is no header set for the mime-type, so the browser just renders it as text. I would like for this file to be ...
116
votes
6
answers
49k
views
MIME type warning in chrome for png images
Just ran my site in chrome and suprisingly it comes up with this warning for each of my .png images:
Resource interpreted as image but transferred with MIME type application/octet-stream.
Anyone seen ...
109
votes
3
answers
178k
views
Sending Multipart html emails which contain embedded images
I've been playing around with the email module in python but I want to be able to know how to embed images which are included in the html.
So for example if the body is something like
<img src=".....
73
votes
2
answers
101k
views
What is "=C2=A0" in MIME encoded, quoted-printable text?
This is an example raw email I am trying to parse:
MIME-version: 1.0
Content-type: text/html; charset=UTF-8
Content-transfer-encoding: quoted-printable
X-Mailer: Verizon Webmail
X-Originating-IP: [x....
70
votes
10
answers
129k
views
How to read text inside body of mail using javax.mail
i'm developing a client mail using javax.mail to read mail inside mail box:
Properties properties = System.getProperties();
properties.setProperty("mail.store.protocol", "imap");
try {
...
62
votes
5
answers
41k
views
Register file extensions / mime types in Linux
I'm developing a Linux application that has its own file format. I want my app to open when you double-click on those files.
How can I register a file extension and associate it with my application ...
60
votes
3
answers
85k
views
Email from PHP has broken Subject header encoding
My PHP script sends email to users and when the email arrives to their mailboxes, the subject line ($subject) has characters like a^£ added to the end of my subject text. This is obviously and ...
56
votes
3
answers
139k
views
Is Content-Transfer-Encoding an HTTP header?
I'm writing a web service that returns a base64-encoded PDF file, so my plan is to add two headers to the response:
Content-Type: application/pdf
Content-Transfer-Encoding: base64
My question is: Is ...
55
votes
9
answers
80k
views
What is the MIME type for TTF files?
I can't find correct MIME type for TrueType fonts. I need it because I'm using File Uploading Class (CodeIgniter) to upload files, and I want to allow only TTF to be uploaded. Tried this:
'ttf' =&...
54
votes
7
answers
82k
views
File extensions and MIME Types in .NET
I want to get a MIME Content-Type from a given extension (preferably without accessing the physical file). I have seen some questions about this and the methods described to perform this can be ...
53
votes
1
answer
5k
views
Microsoft Office 2007 file type, Mime types and identifying characters
Where can I find a list of all of the MIME types and the identifying characters for Microsoft Office 2007 files?
I have an upload form that is restricting uploads based on the extensions and ...
52
votes
5
answers
85k
views
How can I get an email message's text content using Python?
Given an RFC822 message in Python 2.6, how can I get the right text/plain content part? Basically, the algorithm I want is this:
message = email.message_from_string(raw_message)
if has_mime_part(...
50
votes
5
answers
54k
views
Is Java 8 java.util.Base64 a drop-in replacement for sun.misc.BASE64?
Question
Are the Java 8 java.util.Base64 MIME Encoder and Decoder a drop-in replacement for the unsupported, internal Java API sun.misc.BASE64Encoder and sun.misc.BASE64Decoder?
EDIT (Clarification): ...
50
votes
1
answer
72k
views
Which MIME type is correct for (modern) Windows .exe files?
I try to find which MIME type corresponds to the each extension and I get ambiguous results.
According to webdesign.about.com the correct MIME for exe is: application/octet-stream
According to ...
47
votes
2
answers
88k
views
MIMEMultipart, MIMEText, MIMEBase, and payloads for sending email with file attachment in Python
Without much prior knowledge of MIME, I tried to learned how to write a Python script to send an email with a file attachment. After cross-referencing Python documentation, Stack Overflow questions, ...
46
votes
6
answers
57k
views
Correct Apache AddType directives for font MIME types
I’m using @font-face for embedded fonts (thanks Paul Irish). In trying to fix Chrome’s warning about wrong MIME type for woff fonts, I’ve discovered a mass of conflicting suggestions.
Everyone seems ...
46
votes
2
answers
21k
views
JAX-RS (Jersey) custom exception with XML or JSON
I have a REST service built using Jersey.
I want to be able to set the MIME of my custom exception writers depending on the MIME that was sent to the server. application/json is returned when json is ...
42
votes
1
answer
43k
views
What rules apply to MIME boundary?
When you are writing MIME, you separate different chunks of your message with a certain boundary. I failed for some reason to find any documentation explaining this boundary, but here's what I ...
41
votes
3
answers
23k
views
Maximum length of a MIME Content-Type header field?
I'm just designing the schema for a database table which will hold details of email attachments - their size in bytes, filename and content-type (i.e. "image/jpg", "audio/mp3", etc).
Does anybody ...
40
votes
1
answer
3k
views
How to add a custom MIME type and override a default extension pattern?
I am trying to add a custom mime type to Apache Tika.
I have the following custom-mimetypes.xml document in org.apache.tika.mime :
<?xml version="1.0" encoding="UTF-8"?>
<mime-info>
&...
37
votes
8
answers
138k
views
How to set MimeBodyPart ContentType to "text/html"?
The program below shows an unexpected return value for HTML multipart MIME type. Why does this program print text/plain and not text/html?
public class Main {
public static void main(String[] args) ...
37
votes
4
answers
73k
views
Add mime type to HTML link
I know how to change the MIME type in a webserver. I used this to make sure the browser downloads my .scrpt file instead of opening the plain text version. So far so good but is it possible to do the ...
35
votes
9
answers
37k
views
How can you read a files MIME-type in objective-c
I am interested in detecting the MIME-type for a file in the documents directory of my iPhone application. A search through the docs did not provide any answers.
33
votes
8
answers
97k
views
Inline images in email using JavaMail
I want to send an email with an inline image using javamail.
I'm doing something like this.
MimeMultipart content = new MimeMultipart("related");
BodyPart bodyPart = new MimeBodyPart();
bodyPart....
32
votes
2
answers
55k
views
How to create an email with embedded images that is compatible with the most mail clients
We have created a system that allows embedding an image in an outgoing email.
Here is the original message our system creates. This example contains an image attachment and an embedded image.
Mime-...
31
votes
4
answers
117k
views
no video with supported format and MIME type found. What does this mean and how can I change this
no video with supported format and MIME type found
A huge screen for video is displayed and says the message above. How do I solve this?
This happens to me only in Mozilla Fire fox and not on Google ...
30
votes
9
answers
10k
views
How do you get the icon, MIME type, and application associated with a file in the Linux Desktop?
Using C++ on the Linux desktop, what is the best way to get the icon, the document description and the application "associated" with an arbitrary file/file path?
I'd like to use the most "canonical" ...
28
votes
6
answers
33k
views
Python IMAP: =?utf-8?Q? in subject string
I am displaying new email with IMAP, and everything looks fine, except for one message subject shows as:
=?utf-8?Q?Subject?=
How can I fix it?
28
votes
7
answers
87k
views
Embedding attached images in HTML emails
If I attach an image to an email, how can I place it in the HTML content? I tried just using the filename as the image source but that doesn't seem to work.
27
votes
8
answers
44k
views
Get Content Type of Request
To find the incoming content type, docs say:
request.headers["Content-Type"] # => "text/plain"
But I found by trial-and-error, that doesn't work, but this does:
request.headers["CONTENT_TYPE"]==...
27
votes
9
answers
61k
views
Jersey: A message body writer for Java Class and MIME mediatype application/json was not found
after trying to figure out what's my problem I finally decided to ask you how to solve my problem. I've seen different people with the same problem and I tried all the things they were adviced to do ...
27
votes
3
answers
30k
views
How to check if a file is a valid image?
I am building a web application.
On one of the pages there is an upload form, where user can upload a file. After the upload is done, I want to check on the server if the uploaded file is an image.
...
27
votes
1
answer
18k
views
mimemagic install error: "Could not find MIME type database in the following locations..." on Windows [duplicate]
I am running into the following error when trying to install mimemagic 0.3.10 in a Ruby on Rails project. Note that it is run on a Windows environment. Here is the most relevant error stack trace:
...