Answer the question
In order to leave comments, you need to log in
How to get the MIME type of a file using JS/JQuery?
Straight to the point. I use the Formstone library to asynchronously send headers to the server during file uploads. You can pass any code to the library that corresponds to a specific event, such as initiating a download, starting a download, loading in progress, and so on.
You need to get the headers of a specific file at the initiation stage and read its MIME type, so that later you can either download files or not download them. How to do it?
Answer the question
In order to leave comments, you need to log in
In general, I dug into the object returned by the library. The MIME type is in objectName.file.type
, where objectName is the object that comes as the second parameter passed to the callback function. Suddenly, to whom it is useful.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question