Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PHP File Upload Tutorial - Limit file extensions too!

Loading...

Sign in or sign up now!
7,298
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Apr 4, 2009

This tutorial will teach you how to upload files using PHP. It also teaches you to limit the extensions that are allowed for example jpg, gif, png etc. The script is available at http://byteforums.com

Remember:
http://byteforums.com - Web development community I'm involved
http://jjcon.co.uk/ - My Blog

Category:

Science & Technology

Tags:

License:

Standard YouTube License

  • likes, 0 dislikes

Link to this comment:

Share to:

Uploader Comments (W3Hut)

  • lol. what language is he speakin'?

  • @moro116 Um..... English...

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.

see all

All Comments (35)

Sign In or Sign Up now to post a comment!
  • 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!

Loading...

0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more