Home >Backend Development >PHP Tutorial >Solution to the problem that codeigniter cannot correctly identify the image type when uploading images, codeigniter uploads images_PHP tutorial
When using the upload class of codeigniter to upload an image, it is obviously a jpg format image, but ci always recognizes it as an application/octet-stream type, causing the upload to fail. After collecting the information, the solution is as follows:
Enable the fileinfo extension in php.ini to get the correct type:
//linux
extension = fileinfo.so
Note: About fileinfo
PHP officially recommends that the alternative function to mime_content_type() is the Fileinfo function. PHP 5.3.0+ already supports the Fileinfo function (fileinfo support-enabled) by default. You can use finfo_open() to determine the file MIME type without any configuration. The PHP version of the LAMP environment installed by Centos by default is still PHP5.2.6. If the version is lower than 5.3.0, a similar error message may appear: PHP Fatal error: Call to undefined function finfo_open() in…. Because the previous PHP version needs to load the magic_open class, the fileinfo function belongs to the PECL extension, and the fileinfo PECL extension can be enabled
I don’t know if this can solve the problem, try it:
1. Delete the current ACDSEE in Start->Control Panel->Add/Remove Programs;
2. Enter "regedit" in Start->Run and press Enter to enter the registry editor;
3. Click "My Computer" and use the shortcut key "Ctrl+F" to enter the search;
4. Enter "acdsee" in the search dialog box and delete all related content found; (Note, it is best to use "File -> Export" to back up the registry before deleting, and search again after deletion) Confirm that it has been deleted)
3. Close the registry editor and use "Super Rabbit" to clean the registry and hard disk (all acdsee-related installation files, including hidden ones, are deleted)
4. Restart the system and install the official ACDSEE software package. (It is best not to use test versions, trial versions, etc. that are downloaded from some small websites. There may be bugs. In addition, try not to use Chinese versions, which are also more likely to cause problems. It is strongly recommended to use a mature and stable version. The latest version is generally full of bugs. More)
Wish you good luck in solving the problem:)
File format, usually jpg or gif may be bmp...