mime-types

In-memory mime-type detection with Cocoa (OS X)?

Hello everyone, My application is a viewer for a custom format, a zip file with a well defined XML manifest and resources, such as images and movies. I use zlib to open up the zip file in memory and then proceed to display said resources. One problem I've ran into is that I'm unable to properly display videos, apparently because QTMov...

What is the best way open/edit a data Stream if all I have is a MIME type

I am in a Windows Desktop application and I have a data stream and a mime type in the database. Is there a better way than writing it to a temp folder and launching the default editor for it? If I have to use the temp folder how can I get the file extension from the MIME type in a C# Windows Desktop application? ...

How to check file types of uploaded files in PHP?

On the PHP website, the only real checking they suggest is using is_uploaded_file() or move_uploaded_file(), here. Of course you usually don't want user's uploading any type of time, for a variety of reasons. Because of this, I have often used some "strict" mime type checking. Of course this is very flawed because often mime types are w...

YAML mime type?

What is the most appropriate MIME type to use when sending data structured with YAML over HTTP? An explanation of why a given choice is most appropriate would be much appreciated. There is no registered application type or text type that I can see. Example: > GET /example.yaml < Content-Type: ???? < < --- # Favorite movies < - Casab...

Adding a mimetype in python

On my Centos server Python's mimetypes.guess_type("mobile.3gp") returns (None, None), instead of ('video/3gpp', None). Where does Python get the list of mimetypes from, and is it possible to add a missing type to the list? ...

Return file from python module

Edit: How to return/serve a file from a python controller (back end) over a web server, with the file_name? as suggested by @JV ...

How do I fix Firefox trying to "Save image as" .htm?

Hi! We've recently implemented Amazon S3 in our site which led us to change the way we handled images. We used to call a controller /fotos.php that would read the file from disk, record some statistics, set headers and return the contents of the file as image/jpeg. All went OK until S3. Fotos.php now does a 302 redirect to the resource...

How do I make my Apache 2 server force a browser to open a file transfer dialogue?

How do I make my Apache 2 server force a browser to open a file transfer dialogue if the URL points to a file with a .pln or .psa extension? I have a simple LAMP server with CentOS 5, Apache 2, MYSQL 5, PHP 5, recently built CentOS 5.2 i386 installation CDs. My web application generates files to be downloaded and imported into a custom ...

Get MIME type from filename in C

I want to get the MIME type from a filename using C. Is there a way to do this without using a textfile containing MIME types and file extensions (i.e. Apache's file mime.types)? Maybe there is a function to get the MIME type using the filename? I rather not use the file extension if I don't have to. ...

How to categorize Mime Types (PHP)

I'm looking for a code snippet which categorizes mime types. For example, application/msword application/vnd.oasis.opendocument.text application/pdf Both of them are office files. When I pass these mime type to the function, I want it to return a result which is 'office', 'image', 'application', 'compressed' etc. However,as you kn...

Classic ASP/IIS6: How to search the server’s mime map?

This is the same question as this but I'm looking for a classic ASP solution. I have a third party control to provide secure downloads but it expects you to provide the response.contenttype value. I'm trying to have the browser prompt with the following: Response.AddHeader "Content-Disposition", "attachment;filename=""" & strFileName &...

Apache alternatives to PHP header function.

I'm working on a website that has a number of style sheets all of which need to be handled as php scripts server-side. My .htaccess file looks something like this: <FilesMatch "\.(css)$"> ForceType application/x-httpd-php </FilesMatch> This causes a small problem as the mime type of the http-response's Content-Type field is then s...

File Extension to MIME Type Web Service?

Are there any web services which will allow me to provide a file extension and it would return a list of possible MIME types? For example: http://mimetype.com/getMime/doc Which could return: application/msword,application/docappl/text,application/vnd.msword,application/vnd.ms-word,application/winword,application/word,application/x-...

What is the correct MIME type to use for an RSS feed?

Is one MIME type preferable to ensure compatibility with RSS readers and other scrapers? The options seem to be: text/xml text/rss+xml Interestingly Stackoverflow is using text/html. ...

Maximum MIMEType Length when storing type in DB

What are people using as the length of a MIMEType field in their databases? The longest one we've seen so far is 72 bytes: application/vnd.openxmlformats-officedocument.wordprocessingml.document but I'm just waiting for a longer one. We're using 250 now, but has anyone seen a longer MIMEType than that? Edit: From the accepted answer,...

Detecting MIME type in PHP

I'm looking for the best (possible on most PHP 5.2 installs and still actively developed) way to detect a files MIME type in PHP. I'm aware of the mime_content_type() method and the Fileinfo extension, however mime_content_type() is unreliable and deprecated, and Fileinfo doesn't come in a "standard" PHP (5.2) install. Do I have any o...

Debug message "Resource interpreted as other but transferred with MIME type application/javascript"

OK, I understand what the messages means, but I'm really not sure what's causing it. I'm using Safari and the Web Inspector on Mac OS X, by the way. I've got the following in my document head: <script src="http://local.url/a/js/jquery.js" type="text/javascript"></script> <script src="http://local.url/a/js/jquery.inplace.js" type="text/...

How do I download a file with a non-HTML content type from within a browser?

I'm trying to use content negotiation to give both a HTML and a RDF/XML representation of a resource on a HTTP server. On the server side this works, i.e. curl -H "Accept: application/rdf+xml" http://localhost:8182/ontologies/1 will retrieve the correct version. I can also do the same with JavaScript/Dojo: function downloadOntologyRD...

"not well-formed" error in Firefox when loading JSON file with XMLHttpRequest

I'm getting a "not well-formed" error in the error console of Firefox 3.0.7 when the JavaScript on my page loads a text file containing an object in JavaScript Object Notation format. If the file contains nothing but the JSON object, it produces the error. If I wrap the object in <document></document> tags it does not produce the error. ...

How do I determine a file's content type in .NET?

My WPF application gets a file from the user with Microsoft.Win32.OpenFileDialog()... Private Sub ButtonUpload_Click(...) Dim FileOpenStream As Stream = Nothing Dim FileBox As New Microsoft.Win32.OpenFileDialog() FileBox.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) FileBox.Filter = ...