Getting Microsoft 10 Edge Browser Mime Types php

When checking mime file types of files loaded in the Microsoft 10 Edge browser, I get this Mime type for .doc files:

 application/octet-stream 

Apparently this means โ€œarbitrary binary dataโ€: Do I need Content-Type: application / octet-stream to download the file?

In other browsers, I get application/msword

Is there a new type of mime types for .doc files for the Edge browser, and possibly for other mime types that I need to know about?

Update:

I grabbed the mime type using php $_FILES['uploadName']['type']

+5
source share
1 answer

I found that instead I get the correct mime type:

 $finfo = new finfo(FILEINFO_MIME_TYPE); $mimeType = $finfo->file($_FILES['uploadName']['tmp_name'][$key]); 

And as Martin said in the comment above:

You should not grab the MIME type from the data specified in $ _FILE, as it is very flaky and for interpretation, as you are going through. Instead, do a new analysis of the loaded temporary file, use finfo () or similar.

+4
source

Source: https://habr.com/ru/post/1232478/


All Articles