mime-types

How to show 'Save as' dialog box using PHP for text files

How can I show the 'Save as' dialog box using PHP which will ask the user to download a string as a text file? Basically I will retrieve some values from the database, and want then to be able to download a .txt file which contains this data. ...

IIS website is sending multiple content-type headers for zip files

We have a problem with an IIS5 server. When certain users/browsers click to download .zip files, binary gibberish text sometimes renders in the browser window. The desired behavior is for the file to either download or open with the associated zip application. Initially, we suspected that the wrong content-type header was set on the fi...

PHP's FILEINFO_MIME option returns empty string

I'm trying to check the MIME type of an uploaded file in my PHP application. I upload the file, then do this, where $file is the path to my file: $finfo = new finfo(FILEINFO_MIME); $mimetype = $finfo->file($file); In this situation, $mimetype is always an empty string. I've tested on several file types (.jpg, .doc, .txt, .pdf) and it...

Best Way to Determine if *.doc File is RTF with Java or Coldfusion

So I have about 4,000 word docs that I'm attempting to extract the text from and insert into a db table. This works swimmingly until the processor encounters a document with the *.doc file extension but determines the file is actually an RTF. Now I know POI doesn't support RTFs which is fine, but I do need a way to determine if a *.doc...

Uploading PDF v1.3 to DB

I have some C# code that will upload images and files into a db. Currently I thought It working for all documents that fit a list of mimetypes. However It fails on some pdf's. I have narrowed the problem down to the fact that some pdf's are in the 1.3 format and some are in the 1.4 format. The 1.4 works and is properly uploaded, however...

What's a good, free, drop-in set of mimetype icons?

I want a set of mimetype icons to go with my file uploads, to show in users' files lists and the like. It should be: 16x16 PNG or JPG (other sizes through 64x64 would be a bonus but not required) already organized such that I can do e.g. mimetype.sub('/','-') + '.png' and get the icon file name (I'd like to avoid spending a bunch of t...

How can I duplicate a website's settings in IIS7?

I'm going mad trying to get an ASP.NET application running on IIS7 (Server2008). I have one web site set up in IIS7 which works fine. I'm trying to create another one now but I only get 404s for all .aspx files. The Handling Mappers are all different from the working site's. Is there any way I can duplicate the working site's settings s...

Mime type for zip file in Google Chrome

I discovered a weird issue in zip file's mime type when I worked on a Symfony application. According to w3school, the mime type for zip file is application/zip. This is what I believe, too. But when I upload a zip file in my Symfony app with IE, the mime type of that zip file is application/x-zip-compressed. When I upload a zip file i...

How can I serve VBS and other file types as plain text from a Subversion repository (Apache)?

I just want to browse my Subversion code repositories and view files. Some of the file types, like .VBS, prompt me to open or save the file, but I just want to view it in the browser as plain text. Can Apache's httpd.conf file be modified to do this? I don't think it would be changed on the client (IE7) because then it would work the ...

Return a PHP page as an image...

I am trying to read a image file (.jpeg to be exact), and 'echo' it back to the page output, but have is display an image... my index.php has an image link like this: <img src='test.php?image=1234.jpeg' /> and my php script does basically this: 1) read 1234.jpeg 2) echo file contents... 3) I have a feeling I need to return the outpu...

URN for MIME Type

Hi there, Does an official URN for the MIME type exist? Mozilla Firefox and other applications use notations like "urn:mimetype:text/plain" or "urn:mimetype:handler:text/plain". There are two problems with this approach: No "mimetype" namespace exists according to the IANA's official registry (http://www.iana.org/assignments/urn-name...

Getting Mime-Types Over FTP In PHP

I'm writing an object in PHP that displays files on an FTP server. I am using PHP's built in FTP functions to retrieve most of the details I need (filename, size, last modified, etc.). However, there are no functions to get the mime-type of a file on the server. I have tried two different methods that work, but I'm having some issues....

How can I use IronPython to to set a MimeType in IIS?

I need to write a simple IronPython script to work with MimeTypes within IIS. I have scripts to modify other IIS configurations but can't seem to get any MimeTypes. The attached script does not return any results. Running the same code within a C# console application produces the desired results. What do I need to do to get the at...

IIS not serving .net control (.dll)

I'm serving a .net user control in .dll form. It displays in IE7 fine when served from my external IIS 6 server. However when served from a IIS 5 the control is rendered as a Text Area control with a Scrollbar control on the side. I had a look at the http response - IIS5 is serving this: <html><head><title>Error</title></head><body>T...

How can I know if a string represents a valid MIME type?

I have a whole bunch of string that are supposed to represent MIME types. However, some of these string have bad/invalid MIME types. Is there a way in the .NET framework to get a list of valid MIME types? ...

Pop3 Episode 2: Mime Type strategy?

Okay, so let's say I have a message fetched from a pop3 server. What I ultimately want to do is to put it in its corresponding user's mailbox, which is an XML file. For the headers, I managed something good already, so I don't need to think about it, I have to do the message body's part. How should I process the file? For now, my log...

Can’t get IIS to serve .js files from a specified directory

I'm running IIS 5 on a Windows 2000 machine. I have an application setup in my "scripts" directory in my website, because it runs some compiled DLL's. The application is set to run scripts and executables. For some reason, when I try and access any .js files in that directory, I get "The system cannot find the file specified.". I trie...

Is there an enum for the ContentType property on a HttpWebResponse ("text/plain", "application/octet-stream" etc.)?

The closest thing I could find was System.Net.Mime.MediaTypeNames but that doesn't seem to have everything (like json) since it seems to be more focused around email attachments. ...

WPF & Mime types

It is about WPF application which generates reports. Reports have simple structure: byte[] m_Data, string m_Mime. Data array is created, mime type is set, now what I need is to display the dialog with same functionality we find in web browsers' - Open/Save/Cancel dialog that opens file in appropriate application depending on response's...

json problem (valums ajax uploader with zend framework)

Hi, I am using the ajax uploader and the Zend Framework. The Problem is when I am using the json response for the onSubmit. With $this->getHelper('Json')->sendJson($data); I only get a saveas dialog. The problem is that the uploader expects every responste to be "text/html" but the json helper sends "application/json" as mimetype. Wi...