Home >Backend Development >PHP Tutorial >swfupload SWFUpload and CI cannot correctly upload the identified file MIME type solution to share
The solution is as follows, other frameworks are the same.
Source code (/system/libraries/upload.php 199 line)
$this->file_type = preg_replace("/^(.+?);.*$/", "\1", $_FILES[$field ]['type']);
Modify as follows:
Copy the code The code is as follows:
//Edit By Tacker
if(function_exists('mime_content_type')){
$this->file_type = preg_replace("/^(.+?);.*$/", "\1", mime_content_type($this->file_temp));
}else{
$this->file_type = preg_replace("/ ^(.+?);.*$/", "\1", $_FILES[$field]['type']);
}
The above has introduced the solution to the problem that swfupload SWFUpload and CI cannot correctly upload the MIME type of the recognized file, including the content of swfupload. I hope it will be helpful to friends who are interested in PHP tutorials.