52: Upload files and images to website in PHP – PHP tutorial

Upload files and images to website in PHP – Learn PHP backend programming. In this episode I will show how to easily upload images and files to a website.

We will also learn how to add error handlers specific to uploading such as file size and file type.

Lesson materials: https://www.dropbox.com/s/cp1o8788bzd5te2/62.zip?dl=0

mmtuts is a YouTube channel that focuses on teaching beginner and advanced courses in various multimedia related skills.
We plan to make tutorials available on programming, video production, animation, graphic design, and on software such as the Adobe Creative Cloud programs.

PHP for beginners is a how to series that teaches the PHP coding language to people who are just starting out learning programming. The course teaches how PHP scripting can be made easy and teaches how to build many apps such as a login system, a comment section, how to upload images, how to create users in a website, and much more. Creating dynamic websites with PHP is easy and should not be seen as otherwise, which is why we want to explain the language in a easy to understand way for beginners.

If you have suggestions on new courses, or specific lessons within existing courses you would like to see, then feel welcome to submit them in the comment section or in a private message. ALL suggestions will be seen, but not all will be replied to since we get quite a few every day.


thegeekside says:

idk what i’d learn if it’s not for your existence in youtube, lol. good tutorials fam.

Jireh King says:

hello , how do i redirect the destination of the image from uploads to a database table..Instead of a upload to a folder , i want to upload it to a database table

Miguel123d _ says:

Thanks a lot for the video! very very usefull

Kerrid Esor says:

Hey Daniel, how does this work once a website is hosted online? How many images are you able to upload, and are they still uploaded into a file like they are when working locally?

Daniel Choo says:

Sorry, I still cannot upload image into uploads folder. Why?

Sudirman Sukijan says:


crueldaemon says:

Very clear and easy to keep track of

Don Park says:

What if we want to upload the file into a MySQL database?

Umair Mukhtar says:

Comprehensive lesson on PHP File Uploading

Anshu Aditya says:

will you please explain how to upload multiple files with the same validation (as you did for single input in this video)

tom hoffman says:

awesome! best programmer! keep it up mmtuts! works well!
i mean how u know jquery, javascript, php, ajax, html, css, sql, and god knows what else?
what if you have way too many users to store their images on your personal computer?
is their a way of storing and accessing it from somewhere else, say google cloud?

Md. Shohanur Reza Badhon says:

Thank you for your videos. Its really very useful and helpful. I am using the way that you have described. I have modified but its failing.

I have a form that have 3 image input boxes and 12 text Boxes and a submit button. I want to display images onchangeevent function. When I press first image upload box it goes to upload.php directly and index.php disappear.

What should I do Now?

JCL Trading Company says:

Daniel can you post a tutorial on converting word or document files into pdf while uploading ?

oussama bouchareb says:

10:32 ( ‘ . ‘ , )

Curt Turdle says:

this is missing information, like changing folder permissions to allow uploads

Let's Discover Realities says:

how to make thumbnails and how to upload a image in it ?

Mohamed Abdelrhman says:

thanks, it was very helpful.

DuxPlay says:

how i upload with original name and without the FileNameNew

soumil thakar says:

how do i display the latest uploaded image in the folder on a page ??

sravanth kumar says:

Instead of uploading the file into a folder, how to make it visible ? Like….When we hit choose a file button and chooses a file ….And uploads….We get the file image on the top like in Facebook….How to do that ?

ravi prakash says:

how i will upload video on cloud using php?? please help

Danny Dan says:

what about doc file?

Daniela Oliveira says:

This is a very good tutorial. Really, thanks! but I think I am still missing something here. Could you help me understand something about my code because I am trying to integrate this upload code in another form and it is not working… Can I send you an email or ask you this on twitter or something, please?


very nice and straightforward tutorial.. keep it up dude.. thanks.

R Williams says:

it worked , thanks..is most of the tutorial not on here,,doesnt show how to display on a website.. video 54 says it does.

Martijn Schuman says:

Is it possible to upload multiple files at ones?

Eric Smith says:

Awesome tutorial, subscribed.

ayush gupta says:

sir why my images can’t stored in my uploads folder can you solve this problem

Advocat says:

You copied Codecourse’s “PHP File Uploading” video. Shame on you!

NordX_Panda - Norsk Gaming says:

this dont work for me

Ricardo Pires says:

Thank you so much!

ReneMar Remorosa says:

This is so helpful! You and Traversy Media is all I trust with this kind of things.

Car Donate says:


McGavel1 says:

Cool stuff thanks

Daniella Johansson says:

Just a shout out to the Ubuntu people. If you get uploadsuccess but no img in the folder…check your rights.

pepijn de oude says:

14:10 , Shouldn’t you create the exlusion/ “error handlers” first before creating the allowed things? (You said this in episodes before)

Harsh Raval says:

Nice !

roinomade says:

GREEEEEAT !!!! Thanks

 Write a comment


Do you like our videos?
Do you want to see more like that?

Please click below to support us on Facebook!