Upload the class with CodeIgniter upload pictures, is clearly jpg format picture, but CI is always recognized as a application/octet-stream type, resulting in upload failure, collected the following data, the solution is as follows:
Open the FileInfo extension in php.ini to get the correct type:
Copy Code code as follows:
Windows
Extension = Php_fileinfo.dll
Linux
Extension = fileinfo.so
Note: About FileInfo
An alternative function of the official PHP recommendation Mime_content_type () is the FileInfo function. The PHP 5.3.0+ already supports the FileInfo function (FileInfo support-enabled) By default and can use Finfo_open () to determine the file MIME type without any configuration. Centos The default installation of the lamp environment PHP version or PHP5.2.6, less than 5.3.0 version may appear similar error prompts: PHP Fatal error:call to undefined function finfo_open () .... Because the previous PHP version requires loading the Magic_open class, the FileInfo function belongs to the pecl extension, enabling FileInfo pecl extension to