PHP File Upload Tutorial - Limit file extensions too!
Uploader Comments (W3Hut)
Top Comments
-
The main problem is the file extension checker in this. Some people usually put more than one dot in the file name, so that method will fail. You should do this:
$exten = end(explode('.',$string));
This one is way better, because it explodes your string where the last dot is.
All Comments (35)
-
can you please give a direct link to the upload.php file because the forum you want us to find the script is impossible to navigate. would be much appreciated
-
wow... very messy indeed
-
@W3Hut Nice accent ^^
-
@davekofo I'll see if I can whip together something a little bit more complex that does a little bit more but keeps the straight forward validation for ya.
-
@davekofo Ultimately the more functions I use in these tutorials the less likely it is for a beginer to understand...
-
@W3Hut You could just use the PHP function: $exten = strtolower($exten);
That would change caps to lower case.
-
@JordiFun Actually it's not, the scrip renames the file and deletes everything after the specified extension so no opportunity for exploits here...
By the way I would love that script, it's the most straight forward php file upload validation I've seen, clever stuff!
-
Liked your page and thought to say hi!
-
Liked your page and thought to say hi!
lol. what language is he speakin'?
moro116 1 year ago
@moro116 Um..... English...
W3Hut 1 year ago 6