尝试上传时出现以下错误:
“您尝试上传的文件类型不允许。”。
这是我为 .doc 制作的 mime:
'doc' => array('application/msword','application/doc','appl/text','application/vnd.msword','application/word','application/winword','application/vnd. ms-word','application/x-msw6','application/x-msword'),
正如你所看到的,我已经尝试通过添加更多的哑剧来弥补它。我不知道问题可能是什么......文件是.doc。请注意,上传 pdf 确实有效!我也在用mac。
这是我的代码:
$sntError = $this->uploadFile($id,'notes','doc|pdf|docx');
private function uploadFile ($id,$input,$extensions) {
$this->load->library('upload');
$config['allowed_types'] = $extensions;
$config['upload_path'] = './upload/sermon/'. $input;
$config['file_name'] = $input .'-'. $id;
$config['max_size'] = '10000';
$config['overwrite'] = true;
$this->upload->initialize($config);
$uploaded = $this->upload->do_upload($input);
$errors = $this->upload->display_errors('<div class="error">', '</div>');
if (!$errors && $uploaded) {
$fileData = $this->upload->data();
$this->saveSermonAttachments($id,$input,$fileData['file_name']);
} else {
return $errors;
}
}