简体   繁体   中英

getting different mime type for exe file in php

I am trying to get mime type of an exe file in PHP. It's returning application/x-dosexec . but the mime type of an exe file should be application/x-msdownload .

I am checking with a temporary file name($file_tmp_name) , using the code below:

$finfo = finfo_open(FILEINFO_MIME_TYPE);
echo finfo_file($finfo, $file_tmp_name);
finfo_close($finfo);

application/x-dosexec is actually a subtype of application/x-msdownload , specifically having the .exe glob.

You don't need to check for all possible mime types, just check if it belongs to the parent executable mime type. See how it's done with mediatype here .

Ref: Summary of application/x-dosexec from webarchive.org.uk

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM