CodeIgniter Forums
CI4 validation for file upload accepting any type of file except some extensions - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: CI4 validation for file upload accepting any type of file except some extensions (/showthread.php?tid=81673)



CI4 validation for file upload accepting any type of file except some extensions - serialkiller - 04-07-2022

How can I use file upload validation accepting any file type except some extensions, there is no method like is_file or mime_not_in, create a list of all possible mimes I find it long, I would find it easier to accept everything except ... how can I do ?


RE: CI4 validation for file upload accepting any type of file except some extensions - ignitedcms - 04-07-2022

That would be very dangerous not recommended. For various file types there should be a simple * opt IIRC, but accepting ANY filetype except a few is not very smart.


RE: CI4 validation for file upload accepting any type of file except some extensions - serialkiller - 04-07-2022

(04-07-2022, 05:45 AM)ignitedcms Wrote: That would be very dangerous not recommended. For various file types there should be a simple * opt IIRC, but accepting ANY filetype is not very smart.

In fact I don't want to accept every type of file, but every type, EXCEPT a few


RE: CI4 validation for file upload accepting any type of file except some extensions - JustJohnQ - 04-07-2022

Your except list would be very long as you definitely don't want to upload php, sql, exe, cmd, vbs, dll, bat, etc....


RE: CI4 validation for file upload accepting any type of file except some extensions - serialkiller - 04-07-2022

(04-07-2022, 06:12 AM)JustJohnQ Wrote: Your except list would be very long as you definitely don't want to upload php, sql, exe, cmd, vbs, dll, bat, etc....

Maybe I had to write: I know the risks with some extensions, and it is for this reason that I would like to upload almost everything (not all), because unfortunately in the real world you do not upload only images, but there are many other types of files that are more than safe and they are certainly many more than unsafe files, at least in my opinion