1. 程式人生 > >雷林鵬分享:CodeIgniter文件上傳錯誤:the filetype you are attempting to upload is not allowed

雷林鵬分享:CodeIgniter文件上傳錯誤:the filetype you are attempting to upload is not allowed

谷歌 emp this over 修改 jpeg let 命名 onf

  CodeIgniter文件上傳錯誤:the filetype you are attempting to upload is not allowed

  在本地lnmp測試環境文件上傳成功,代碼移至到生成環境後,提示 the filetype you are attempting to upload is not allowed 錯誤,谷歌了N久才找到解決方法。

  網絡上有說出現 the filetype you are attempting to upload is not allowed 錯誤的可能原因:

  1、重命名導致,去除重命名配置項

  2、重名不帶後綴

  .....

  最終解決方法:

  修改前:

  $config[‘allowed_types‘] = ‘jpg|gif|png|jpeg|bmp‘;

  修改後:

  $config[‘allowed_types‘] = ‘*‘;

  最終上傳配置項:

  $config[‘upload_path‘] = $save_path;

  $config[‘allowed_types‘] = ‘*‘;

  $config[‘file_name‘] = "{$userid}.png";

  $config[‘overwrite‘] = true;

  $this->load->library(‘upload‘, $config);

  通過把允許上傳類型改為 * ,這樣可能會存在一些安全問題。

  文章轉載自 [http://www.php230.com]

  (編輯:雷林鵬 來源:網絡 侵刪)

雷林鵬分享:CodeIgniter文件上傳錯誤:the filetype you are attempting to upload is not allowed