CodeIgniter upload picture does not correctly identify picture type problem Solving method _php instance

Source: Internet
Author: User
Tags codeigniter

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.