mime-types

PHP how can i check if a file is mp3 or image file ?

how can i check if a file is an mp3 file or image file, other than check each possible extension? ...

How do I return a FileResult in ASP.NET without knowing the MIME type?

My ASP.NET MVC application has pages with attachments and these attachments can be of many different file types. When the user then wants to access their attachment, I need to fire off an FileResult and return the file attachment which I have the path to. However, I have no database of mime-types, nor do I know off-hand the mime-type o...

Checking filetypes when uploading, and browser dependency issues

I'm building a php file uploader and I've some issues with security. For example I don't want to allow ".php" file uploads. As I know the only way to check the file type is with $_FILES['file']['type'] and the value of it is browser dependent. I check with multiple browsers and found that when selecting a regular .php file different bro...

OS/X mimetype handler

I'd like to write a small script that implements RFC4709 for OS/X. I started off by creating an application bundle that registers the application/xml+davmount mimetype and launches a simple python script. It doesn't make a lot of sense to me to make this a .app bundle, because the application is very short-lived, and it also doesn't se...

Stop Eclipse/Subversive from setting svn:mime-type to text/plain on initial commit

How do I stop Subversive from setting svn:mime-type to text/plain on initial commit? My Java code is being checked into my repository with the svn:mime-type property set as text/plain, and as a result my web-based SVN viewer (trac) isn't syntax highlighting. edit: I should add I'm running Eclipse 3.5 and the most recent version of Su...

Get mimetype from filename

MIME::Types.type_for(filename) What gem do I need to install, and what file do I need to require to use that? ...

What is the difference between "image/png" and "image/x-png"?

What is the difference between "image/png" and "image/x-png"? ...

How to send a string from a python script at Google App Engine to the browser client as a file

I have a python web-application running inside the Google App Engine. The application creates on user-demand a string and I want the string to be send to the browser client (application/octet-stream?) as a file. How can i realize this? ...

Creating a download page in ColdFusion 8

I have an application that allows admins to upload files. These files are stored outside of the web root so they are not accessible via a URL. In the past, we have always used code similar to below to then serve the file back to authorized users. Is there a better or more universal way to specify the type? This is especially relevant whe...

IE8 won't download a file with a custom mime/type with UAC enabled

I have a .net service running on the local machine (Windows 7 x64, IE8, .net 3.5, C#) that returns a file to the browser in response to a user action. Using firefox or chrome, the file is downloaded properly and our application is launched via a custom mime type and all is well. However, with IE8, I receive a dialog "unable to download ...

Where can I get the list of most common file extensions and their content type?

So far I have: doc, dox -> application/ms-word xls, xlsx -> application/ms-excel pdf -> application/pdf And so on. Is there a place where I can get a comprehensive list? ...

IIS Files with No Extension

Hi, I recently saw a website in which the url was formulated like this: http://subdomain.domain.com/script/?var=value I was wondering how to do this in IIS, and how he put a slash in between the script and the GET variables, and how he had the script with no extension in the first place. Any help? ...

How can I determine the mime-type of a document using javascript only?

I need to determine the mime-type of certain files that get returned from the service, I do not know their file extensions or what their type is before hand, basically we retrieve documents from the API like such: "http://site.com/getFile/BFD843DFLKXJDF" where the random text at the end is some file. <input type="button" value="Click Me...

ics file mime type

I'm trying to upload an ics file to my site. It was exported from iCal on Mac OSX. I thought that ics files had a mime type of text/calendar, but for some reason this file seems to be of type Application/octet-stream. This makes the upload fail my verification tests. Anyone have any ideas why the type isn't what I expect?! ...

<noscript> processing in XML documents

Is there any difference in <noscript> block processing for pages served with MIME-type text/html versus those served with MIME-type application/xhtml+xml? As far as I noticed <noscript> block for text/html pages is not processed at all if JavaScript is disabled in browser. And what happens for application/xhtml+xml pages? I suspect that...

Zip Mime Type appears unrecognised

I'm trying to return a zip file, as a stream over a browser. This works fine with other types of files (e.g. Excel files) but when I start dealing with zip files I can't get my browsers to recognise that it's a zip. Both Firefox and IE running on my test machine prompt, asking what program to open the file with. Explorer is set as the d...

Generic MIME type for a MIME entity?

Is there such a thing as a generic MIME type for a MIME entity? A MIME entity would be something that consists of a header section, followed by a blank line, followed by a body section (with CRLF line endings) according to RFC 2045/2046. An example could be the following: Header1: Some list Header2: of headers Arbitrary body content ...

What's the correct email attachment MIME type for a zipped and password protected file?

It's zipped and password protected with 7zip, should the mimetype be "application/7zip", or just "data/binary"? Something else? ...

How can I find out a files "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 as for some reason it detects the .png file as an "application/octet-stream"… I'v checked the file, and it really is a .png $ cat /1.png ?PNG (wi...

How should response content type for documents be specified in order to work consistently across browsers?

I'm developing a simple servlet that should serve documents via http. I use URLs in the form of /getDocument?fileId=1234. The servlet simply 1) sets response.contentType and 2) writes to response.outputStream. The problem is about setting the content type correctly in order to have the browsers understand the response (i.e., display the...