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

Solution to the problem that codeigniter cannot correctly identify the image type when uploading images, codeigniter uploads images_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:22:15923browse

How to solve the problem that codeigniter cannot correctly identify the image type when uploading pictures, codeigniter uploads pictures

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:

Copy code The code is as follows:

//windows
extension = php_fileinfo.dll

//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

ACDSEE80 cannot recognize the image file type

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:)

Why can’t the pictures uploaded from the computer to the mobile phone be recognized by the mobile phone?

File format, usually jpg or gif may be bmp...

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/848798.htmlTechArticleThe solution to the problem that codeigniter cannot correctly identify the image type when uploading images. When uploading images with codeigniter, use the upload class of codeigniter to upload images. At that time, it was obviously a jpg format picture,...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn