Tag Archives: csv

HTTP upload MIME type hell

If anyone, like some colleagues of mine, runs into problems when uploading a CSV-file (or any other filetype for that matter) and checking mime-type (content-type), the following info might help.

Deciding the correct mime-type when doing an HTTP Upload is the browser’s responsibility, which produces … well, very mixed results. I made a little test-script and experimented with the same csv-file (with both .txt and .csv as suffix). See the results for yourself:

1. ubuntu 9.04, firefox 3.5.2:
.txt = text/plain
.csv = text/csv
2. work win xp sp2, windows firefox 3.5.2:
.txt = text/plain
.csv = application/vnd.ms-excel
3. work win xp sp2, windows ie6
.txt = text/plain
.csv = application/vnd.ms-excel
4. work win xp sp2, google chrome 3.0
.txt = text/plain
.csv = application/vnd.ms-excel
5. home win xp sp3, internet explorer 8
.txt = text/plain
.csv = application/octet-stream
6. home win xp sp3, firefox 3.5.2
.txt = text/plain
.csv = application/octet-stream
.xls = application/vnd.ms-excel
7. mac os x 10.5, Firefox 3.5.2:
.csv = text/plain
.txt = text/plain
8. mac os x 10.5, Safari 4.0.3:
.csv = application/octet-stream
.txt = text/plain

So as you can’t depend on browsers being strict while sending, you’ll have to be lenient while receiving, won’t you?