S
S
SerDIDG2012-10-01 00:23:50
JavaScript
SerDIDG, 2012-10-01 00:23:50

FileReader and application/zip file

I make a new loader for my project, and in order to tell the user that the format is not supported, I check the file type that the FileReader returns. The bottom line is that the correct mime type of the file has always been returned up to this point, but as soon as I tried to take a zip file compressed with a 7zip archiver, the FileReader returned an empty string in the type field. This is observed both in chrome and in firefox, while the opera correctly determined the file type. Who among the regulars of bug trackers of these browsers can look if such a bug report or is it a feature?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Dedukhin, 2012-10-01
@Demetros

You're relying on what the browser gives as a mime type for nothing. They (browsers) do not know a large number of types and cannot guarantee correct recognition, because produce it based on the extension (under windows). The surest way, in my opinion, is to find or implement the mime-magic analog in Javascript yourself.

S
SerDIDG, 2012-10-01
@SerDIDG

I never cease to be surprised, you ask a question, and some asshole puts a minus without any explanation. I am more and more inclined to think that habr has long turned into chips. There is no corresponding audience.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question