CodeIgniter's file upload library ignores allowed_types?
问题 I tried to upload a certificate file and failed: $config["allowed_types"] = "cer"; $this->load->library("upload", $config); $this->upload->do_upload("fieldname"); I always get the following error, even if I upload a .cer file: The filetype you are attempting to upload is not allowed That is a lie, I uploaded a file of an allowed type! Why does this class ignore its documented setting allowed_types? 回答1: You need to add the mime type in mimes.php config file. It should be something like this: