CodeIgniter Forums
MY_Upload - Extends CI_Upload to understand regular expressions in allowed MIME types array - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22)
+--- Thread: MY_Upload - Extends CI_Upload to understand regular expressions in allowed MIME types array (/showthread.php?tid=51902)



MY_Upload - Extends CI_Upload to understand regular expressions in allowed MIME types array - El Forum - 05-22-2012

[eluser]Unknown[/eluser]
Hi all!

This is small extension that extends CI_Upload to understand regular expressions in allowed MIME types array.

Now you can use regular expression in mimes.php, just enclose them in slashes.

Example:
Code:
'js'    =>      array('/text/','/javascript/')

Explaination:
Fileinfo PHP module cannot determine text types correctly, for some JavaScript files it gets values like 'text/c++', 'text/css' and so on.
But JavaScript files are text files so now you can just put '/text/' in $mimes array.

Extension page: xbsoft.org/codeigniter/.