You may want to start using ternary operators for those simple true/false if statements. Those five lines can be shortened to:
Also, it's not a good idea to rely on the filename passed by through the user as the determent for the file type. I can save an executable file as .jpg, and it would pass your blacklist, whereas it should get blocked. Food for thoughtPHP Code:
return (Block.Contains(Extension)) ? false : true;
![]()
Results 1 to 4 of 4
Thread: [C#] Extension Filter
Hybrid View
- 15 May. 2011 02:07pm #1
- 17 May. 2011 04:38am #2