F
F
Freud's cat2019-01-15 21:26:19
JavaScript
Freud's cat, 2019-01-15 21:26:19

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

1 answer(s)
F
Freud's cat, 2019-01-15
@medbrat69

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 question

Ask a Question

731 491 924 answers to any question