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

260
Vistas
Dropzone Not Recognising File Or MIME Type Request Header. MVC .NET

I am using Dropzone.js to upload a file with an .msg extension and a MIME type of application/vnd.ms-outlook.

When I select a file with a .msg extension the file type is empty.

This can be fixed by implementing an accept function and setting the file type however, when the request is sent the MIME type is set to application/octet-stream which is the default when the content type is unknown or empty.


Question

How can I set the Content-Type for the file e.g. MyFile.msg in the multipart/form-data; to application/vnd.ms-outlook?


Request

POST www.someurl.com
...
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryMagrF5N9EvrTWyiY
Accept: application/json
X-Requested-With: XMLHttpRequest
...

------WebKitFormBoundaryMagrF5N9EvrTAAA
Content-Disposition: form-data; name="Filename"

MyFile.msg
------WebKitFormBoundaryMagrF5N9EvrTAAA
Content-Disposition: form-data; name="Details"

------WebKitFormBoundaryMagrF5N9EvrTAAA
Content-Disposition: form-data; name="file"; filename="MyFile.msg"
Content-Type: application/octet-stream //NEED TO CHANGE

Dropzone

accept: function (file, done) {

        // file.type = ""

        if (file.name.split('.').pop()=== 'msg') {
            Object.defineProperty(file, 'type', { value: 'application/vnd.ms-outlook' });
        }           

        done();
    }
},
init: function () {

    this.on("sending", function (file, xhr, data) {
            // This sets the Content-type for the request not just the
            // uploaded file i.e. one boundary of multipart/form-data

            // var send = xhr.send;
            // xhr.send = function () {
            //    xhr.setRequestHeader('Content-Type', file.type);                  
            //    send.call(xhr, file);
            // };
        }
}

Controller

[HttpPost]
public ActionResult PostFile(HttpPostedFileBase file)
{
    // file.ContentType is application/octet-stream
}
about 4 years ago · Santiago Trujillo
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