When Codeigniter is used to develop File Upload programs, rar and zip packages are not supported by default. This need to be improved. However, we can solve this problem by defining the format ourselves.
When Codeigniter is used to develop File Upload programs, rar and zip packages are not supported by default. This need to be improved. However, we can solve this problem by defining the format ourselves.
The format restrictions of codeigniter when uploading files are defined in the mimes. php file in config of the application folder. By default, this file does not contain rar, and the zip definition cannot be uploaded to a compressed package. We can solve this problem by adding the following code to the class:
The Code is as follows:
"Zip" => array ("application/x-zip", "application/zip", "application/x-zip-compressed", "application/octet-stream "), // only the first three items are available.
"Rar" => array ("application/octet-stream"), // There is no rar at all, and it is added by itself.
,