Codeigniter : The filetype you are attempting to upload is not allowed. Yesterday it was fine

前端 未结 5 1431
忘了有多久
忘了有多久 2021-01-25 23:45

My codeigniter app suddenly broke today. I didn\'t work on the upload code and when I tried to upload an image today I suddenly got \"The filetype you are attempting to upload i

5条回答
  •  无人及你
    2021-01-25 23:57

    I've had this problem twice, here are the two solutions that have worked for me;

    1 - The mime type reported by the system can vary, and may not be in the array of mime types set for a particular file extension. .csv files are the worst I have found for this. Find out what mime type the system is reporting by dumping the upload data after your upload

    die($this->upload->data());
    

    The 'file_type' index will contain a string - add this to the array value with the index that matches the desired file extension in application/config/mimes.php

    2 - The most recent time I have had this is when I upgraded my core Codeiginter version from 2.x to 3.x. I updated the contents of the system directory, but not application/config. I didn't spot the fact that the application/config/mimes.php file is slightly different - the newer version returns an array whereas the old one included it as a var. The fix was to copy in the newer version of mimes.php

提交回复
热议问题