Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

204
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda