Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

203
Views
Input file element's docx file's content type is not correct?

I know that the docx's MIME type is

application/vnd.openxmlformats-officedocument.wordprocessingml.document

But whenever I pick an docx file using <input type="file">, the type is empty ?

<!DOCTYPE html>

<html>
<body>

  <input type="file" id="myfile" name="myfile" multiple><br><br>
  <button onclick="logFile(event)">CLick</button>

</body>

<script>
function logFile(e) {
    var myFile = document.getElementById("myfile");
    console.table(myFile.files[0])
}
</script>
</html>

This code will log a table with type = application/pdf when you pick an pdf, but when you pick a docx file type = ""

Because of the type is empty, when I send it to my server, the browser auto read the docx files as application/octet-stream, which is not what I want

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

MIME types are not really a browser/client thing. Especially Windows knows nothing about them and uses the file extension instead, and neither it nor browsers have have a list or mapping of file extensions to MIME types.

Additionally, even if the browser would send a MIME type, you NEVER can trust anything that a client sends to you. You will in any case need to look at the content of sent file and check if it actually is the file type you expect.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!