![]() |
class CI_Upload - Improvement code suggestion - 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: class CI_Upload - Improvement code suggestion (/showthread.php?tid=3101) |
class CI_Upload - Improvement code suggestion - El Forum - 09-10-2007 [eluser]phpMaster[/eluser] Code: #1 Credit to the Apache developers ..... I have taken one small step towards this in my CI_Upload: Code: class CI_Upload { The only change is line 522 addition: if( $val == 'all') return TRUE; Suggestion: Add 2 new variables, like this: Code: var $types_order = "disallow"; //script alternative: "allow" So by default all types are disallowed. But by script we could change this: Example: types_order: allow allowed_types: all disallowed_types: exe|bin|js Hope you see this is good. I setup an upload for myself at my localhost server. I didnt want to create an array with 100 extensions, to allow myself to upload any file. /phpMaster class CI_Upload - Improvement code suggestion - El Forum - 09-13-2007 [eluser]phpMaster[/eluser] Any comments are welcome. Is my suggestion not good enough? ?? class CI_Upload - Improvement code suggestion - El Forum - 09-13-2007 [eluser]Michael Wales[/eluser] I think CI errs on the side of security. There are literally tens of thousands of file extensions out there and by simply disallowing only a few (exe, bin, js) you are not necessarily securing yourself. In a live environment, I would much rather define the ones I will allow. |