简体   繁体   中英

XAMPP PHP MIME type wrong for .zip

I'm using XAMPP 1.7.7 on Windows XP and doing a upload of a .zip file.

$_FILES shows:
array(1) {
["P24_File"]=>
array(5) {
["name"]=>
string(12) "File.zip"
["type"]=>
string(15) "unknown/unknown"
["tmp_name"]=>
string(22) "...\php1B.tmp"
["error"]=>
int(0)
["size"]=>
int(12927)
}
}

Surprisingly finfo_file() shows "application/zip; charset=binary"...

What's wrong with $_FILES?

This information is supplied by the browser , it has nothing to do with the server. Probably the client's computer doesn't have a ZIP utility installed, or the browser is not aware of the ZIP file type for some other reason.

Because it can be faked (or incorrect, as in your example), you can't trust that info anyway.

finfo_file() is the source to trust here.

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