Fixed Codeigniter not being able to upload rar and zip compressed packages

  • 2021-01-25 07:14:16
  • OfStack

codeigniter's format restrictions for uploading files are defined in the mimes.php file in config under application folder. This file does not contain rar by default, and the definition of zip cannot upload zip packages. We can solve this problem by adding the following code to the class:

"zip" => array("application/x-zip", "application/zip"  . "application/x-zip-compressed","application/octet-stream"),// It was just the front 3 item  
"rar" => array("application/octet-stream"),// Turns out there wasn't one rar this 1 The term, the whole thing is added by itself 


Related articles: