mime-types

How to set default mime-tipe for any file extension in Tomcat 6?

Mime-types are specified in Tomcat's conf/web.xml file. It's look like this: <mime-mapping> <extension>txt</extension> <mime-type>text/plain</mime-type> </mime-mapping> Previously I try following: <mime-mapping> <extension>*</extension> <mime-type>application/octet-stream</mime-type> </mime-mapping> but it doesn't help...

How do I set the mime type in zend framework?

I would like to set the repsonse mime type to application/xhtml+xml How and where do I set that in Zend Framework? Thanks for your help. ...

What is the right way to handle image extensions?

I'm looking to handle image extentions .jpg, .png, .gif, etc. Essentially, what I have is a webserver that takes an image and archives it on the basis of its SHA-1. I use the git convention a1\b2\XXXXXX... with the hex representation of the digest. My question is how is it best to store the extension in the database? Am I safest storing ...

How to determine the type of a file by content?

If I have a file without an extension, how can I determine what type of file it is (music, video, text, etc.)? Are there any hints to determine a file's extension depending on its character components? ...

PDF mimetype, is this a bug!?

I'm uploading a pdf via a ASP.NET web form and checking it's MIME. Sometimes the MIME is reported as applicaton/pdf, not application/pdf. Is this a browser bug? Why would application be spelled wrong? ...

Best Way to determine MimeType from a String?

I have a crawler that downloads pages and tries to parse the HTML. One of the issues I've been facing is how to properly determine what mimetype an HTML file is. Right now I'm using is = new ByteArrayInputStream( htmlResult.getBytes( "UTF-8" ) ); mimeType = URLConnection.guessContentTypeFromStream(is); but it misses sites like this:...

What does a Http response for serving a binary file (.swf) look like?

I need to serve a file on localhost to a certain application which only accepts http URI-s. However, the files are generated on the fly and I would like to avoid writing to disk, so I decided to write a simple HTTP server using QTcpServer. Luckily, I even found a nice tutorial explaining just that. However, I'm not familiar with HTTP res...

Mime Types in the windows registry

Hello, In my windows service built with C# I am trying to set the mime types based on the file extensions as shown below static string GetMimeType(string fileName) { string mimeType = "application/unknown"; string ext = Path.GetExtension(fileName).ToLower(); Microsoft.Win32.RegistryKey regKe...

What's the difference of ContentType and MimeType

As far as i know, they are absolute equal. However, browsing some django docs, i've found this piece of code: HttpResponse.__init__(content='', mimetype=None, status=200, content_type='text/html') wich surprise me the two getting along each other. The official docs was able to solve the issue in a pratical manner: content_type is a...

IIS ignores system.webServer staticContent section

UDPATE On a whim, I decided to upload the 4 fonts files to an font converter. I converted the fontsfrom ttf to ttf and then tried it. Everything works fine: the Content-Type is set correctly and the X-Powered-By header is removed. Weird. I am trying to change the mime type (Content Type header) of a .ttf file in web.config on IIS7. ...

Chrome says "Resource interpreted as script but transferred with MIME type text/plain.", what gives?

Hi All In FF and all, my javascript works fine. But in Chrome it gives this message: "Resource interpreted as script but transferred with MIME type text/plain." I have checked all the script tags and they all have the MIME type="text/javascript". It even says so with jquery and jquery ui. What's up with Chrome? What's the problem and ...

Getting MIME Type in PHP with NO FILE EXTENSION.

I have an e-commerce package called Prestashop. They allow you to sell virtual products, downloadable items, such as software, e-books, etc. They have a problem in their software where they name the physical filename of the downloadable product as a 40-char hash with no extension. Then when a customer goes to download the file, the syst...

how to get the mimeType from an application?

Hi, How would i be able to get the mimeType from an application. I am working on an application which filters certain installed applications based on the mimeType. could someone please help me with this issue ? thanks alot ...

Best way to determine mime type of a file in java?

Curious what the best way is in Java to get the mime-type of a file. It should actually inspect the file because filenames aren't an accurate indicator. Currently I'm using the following which seems to be very hit or miss is = new BufferedInputStream(new FileInputStream(fileName)); String mimeType = URLConnection.guessContentTypeF...

Persistently overriding svn's mime to binary mapping?

For background on my question: svn won't diff a file it thinks is binary $ svn diff data/assets/site/ir_gallery/images.kml Index: data/assets/site/ir_gallery/images.kml =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/vnd.google-earth.kml+xml ...

Detect if user changed file extension to upload?

Using a Java servlet, is it possible to detect the true file type of a file, regardless of its extension? Scenario: You only allow plain text file uploads (.txt and .csv) The user takes the file, mypicture.jpg, renames it to mypicture.txt and proceeds to upload the file. Your servlet expects only text files and blows up trying to read t...

What is the HTTP content type for binary plist?

I am modifying a rails server to handle binary plist from an iPhone client via POST and PUT requests. The content type for text plist is text/plist, as far as I can tell. I would like the server to handle both text and binary plists, so I would like to distinguish between the two forms. What is the content type for binary plist? ...

How Do I Set MIME Type Of A Local File?

I want to be able to set the MIME type of a JavaScript file so that when the file is opened in an internet browser, it is automatically executed. How would I go about doing this? Thank you in advance for your help ...

Is there a way to tell browsers to disable the "run" button when downloading an EXE?

It may be convenient for some of the unlimited bandwidth types to let your users continually download your product and continually forget where they put it and redownload it. But perception of scarcity of is the beginning of wisdom as the bail bondsman said to the coroner as he brought in the week's catch in a two meter gunny sack and I...

Java library or text file that maps mime types to nice human friendly file types.

GOAL My goal is to find a text file or library that enables me to map when given a mime type input and return a nice human friendly format. For example given the mime type for Word (as shown below) I would like a result that is something like "Microsoft Office Word Document". application/vnd.openxmlformats-officedocument.wordprocessing...