![]() |
File Upload Class - MIME type detection error - 2.1.0 - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: File Upload Class - MIME type detection error - 2.1.0 (/showthread.php?tid=46852) Pages:
1
2
|
File Upload Class - MIME type detection error - 2.1.0 - El Forum - 07-23-2012 [eluser]kanhai[/eluser] I did some debugging and found that in the is_allowed_filetype function in line 624 for a csv file the $this->file_type returns text/plain where as when I check in the $_FILES["file"]["type"] it returns text/csv I added the text/plain in the csv array in the application/config/mime.php file and it started working, what I am wondering is that is this a bug? and should I file a bug report for this? There are two possible solutions 1. Find out why there is this difference in these two and fix it (this feels the correct way to solve this) 2. just add text/plain in the csv array in mimes.php file (this seems the easy way, not sure if this is correct). I could file a bug and suggest that we should add the text/plain in the csv array anyway in the next build. Kanhai Chhgani File Upload Class - MIME type detection error - 2.1.0 - El Forum - 08-27-2012 [eluser]zwadder[/eluser] I had the same problem and the suggested solutions didn't work. I had reports that DOCX, PPT and some other extensions wouldn't upload. I found out that all of these files had a MIME type of "application/zip", obviously the came out of a zipped archive, after making an array for the docx type in adding 'application/zip' to the docx mime type did the trick. Then I did the same for the other types and it all worked. I think using this can be tricky because every file can be uploaded by first zipping it and unzipping it en renaming the extension to docx. File Upload Class - MIME type detection error - 2.1.0 - El Forum - 09-11-2012 [eluser]Musaddiq Khan[/eluser] Replace function is_allowed_filetype() in sysetem/libraries/Upload.php, It has worked for me. Code: public function is_allowed_filetype($ignore_mime = FALSE) File Upload Class - MIME type detection error - 2.1.0 - El Forum - 09-12-2012 [eluser]Unknown[/eluser] thank you very much,it really help me a lot File Upload Class - MIME type detection error - 2.1.0 - El Forum - 09-20-2012 [eluser]Stu Green[/eluser] For anyone still struggling with this, the fix in 2.1.2 is not good enough. You also need to add: Code: application/x-zip To the array in the docx mime types too. File Upload Class - MIME type detection error - 2.1.0 - El Forum - 07-17-2013 [eluser]Unknown[/eluser] Just ran into this. If your php version is >= 5.3, make sure you have the php module finfo installed, otherwise the class will fall back on the dirty hack at the bottom which wasn't working for me, resulting in a fail no matter what because it wasn't working properly and leaving no access to the file mime type. File Upload Class - MIME type detection error - 2.1.0 - El Forum - 11-20-2013 [eluser]corescript[/eluser] All my upload are working except .flv files what wrong? anybody can help? thanks File Upload Class - MIME type detection error - 2.1.0 - El Forum - 08-26-2014 [eluser]Unknown[/eluser] I had the same issue when uploading csv files and the following solution worked for me. [quote author="kanhai" date="1343032979"]I did some debugging and found that in the is_allowed_filetype function in line 624 for a csv file the $this->file_type returns text/plain where as when I check in the $_FILES["file"]["type"] it returns text/csv I added the text/plain in the csv array in the application/config/mime.php file and it started working, what I am wondering is that is this a bug? and should I file a bug report for this? There are two possible solutions 1. Find out why there is this difference in these two and fix it (this feels the correct way to solve this) 2. just add text/plain in the csv array in mimes.php file (this seems the easy way, not sure if this is correct). I could file a bug and suggest that we should add the text/plain in the csv array anyway in the next build. Kanhai Chhgani[/quote] |