CodeIgniter Forums
Problems with CSV file uploads not being allowed - 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: Problems with CSV file uploads not being allowed (/showthread.php?tid=54809)



Problems with CSV file uploads not being allowed - El Forum - 09-26-2012

[eluser]Nathan Pitman (Nine Four)[/eluser]
I've just migrated a small app I wrote from one environment to another and I've run into a weird issue with MIME types and the file upload class. I'm uploading a CSV file through a web form and where previously this worked on the new host using the same reference CSV file I get the error:

Code:
The filetype you are attempting to upload is not allowed.
[file_type] => text/x-lisp ) )

I've tried adding text/x-lisp to the application mimes.php CSV array but that makes no odds. I can't even seem to find a clean reference to this mime type online. This occurs both in FF and Chrome so I'm not convinced that it's a browser issue. This is a Smart Machine at Joyent that the app is running on.


Problems with CSV file uploads not being allowed - El Forum - 11-14-2012

[eluser]Nathan Pitman (Nine Four)[/eluser]
Bump... :?


Problems with CSV file uploads not being allowed - El Forum - 11-14-2012

[eluser]Narf[/eluser]
It is indeed not a browser issue - the whole point is to not depend on what the browser sends in order to avoid exploits. It is not a bug either and there are numerous topics here on the forums explaining that. Here's my latest one, short: http://ellislab.com/forums/viewreply/1040236/

I too find it hard to believe that text/x-lisp is returned for a CSV file though, but if the server says so - there's not much you can do about it.


Problems with CSV file uploads not being allowed - El Forum - 11-14-2012

[eluser]Nathan Pitman (Nine Four)[/eluser]
Thanks for the suggestion RE outputting the mime type for the file directly via PHP, doing so highlighted that the 'file type allowed' error I was receiving wasn't realted to the CSV at all but actually to an HTML file being uploaded at the same time (slaps head!). In any case I've now removed 'text/x-lisp' from mimes.php for CSV and added it for html and htm. Problem solved! Smile

Thank you!!!