Image Upload using PHP/MySQL


This code will help you to create a image upload using php. This is unique with other image upload because unlike other this code has a database to store your uploaded image. Hope this code will help, leave comment if you have a question regarding on this code. Thank you and happy coding. database name:photoupload

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Submitted byAnonymous (not verified)on Tue, 10/16/2012 - 07:11

After spending hours looking for a tutorial on file uploads this is the only working one I have found!
Submitted byAnonymous (not verified)on Thu, 01/10/2013 - 02:28

what if i would only want to show one photo, or a specific photo, what codes would i use,, hope you could help me,
Submitted byAnonymous (not verified)on Wed, 01/23/2013 - 14:18

it is note porfect code it stors image in file not in database.......

Submitted byChris1981 (not verified)on Wed, 12/04/2013 - 00:51

In reply to by Anonymous (not verified)

do not tell me you want to actually save the picture file in your database???? :D to the autor: thanks very very much! exactly what i was looking for!
Submitted byAnonymous (not verified)on Sat, 02/16/2013 - 16:23

OMG! The one i've been looking for ages! Thank you for the nice tutorial.. :) 2thumbs up!
Submitted byAnonymous (not verified)on Tue, 02/26/2013 - 23:55

This is good tutorial. It is really helpful
Submitted byAnonymous (not verified)on Mon, 04/29/2013 - 18:09

Submitted bycarlo (not verified)on Sat, 05/04/2013 - 22:58

what will i do if there is nothing happen when i click the submit button? do i need to change some codes?
Submitted byAnonymous (not verified)on Mon, 05/13/2013 - 15:19

Super thank you! It's working! :) but how can I delete or change the picture without changing anything at my database? Thank you!! :D
Submitted byAnonymous (not verified)on Fri, 06/07/2013 - 20:50

Thanks a lot
Submitted byAnonymous (not verified)on Fri, 06/14/2013 - 20:13

Thank u bro u been very helpful
Submitted byAnonymous (not verified)on Sun, 06/16/2013 - 01:36

Is it possible to change the name of the file uploaded somehow? I want to change what ever filename the picture has into the name of the user, who downloads it. Is this possible and is so, how?
Submitted byornthimon Mon, 09/02/2013 - 13:48

Dear all helpers, please help me! I need the codes sample to update image in database using php and mysql, thanks.
Submitted bybiggie (not verified)on Fri, 11/15/2013 - 11:52

Why does it keep saying this? I uploaded the sql file and changed the config. I have others running on the same db so I know it works. What could I be doing wrong?
Submitted byShola (not verified)on Sun, 03/16/2014 - 01:45

thanks you this coed, is working will, but please i have one problem, if i want to view one image from all images in the database. how do i do it
Submitted bycokersholaon Sun, 03/16/2014 - 01:58

Thank for the lovely coed, but i have a problem, if i want to view one image at a time for all images in the in the database, how do i do it
Submitted byLito Sam (not verified)on Sun, 05/04/2014 - 22:06

Good codes but i think you should keep on improving it for users. Limit uploads to only images and limit size and capacity otherwise helped me save someone
Submitted bytieje (not verified)on Thu, 01/12/2017 - 10:53

In reply to by Lito Sam (not verified)

It helped you... save someone?
Submitted bySumedh Golak (not verified)on Sun, 05/04/2014 - 22:25

Where is the .zip file?? Is there any link to download it??
Submitted bykayong (not verified)on Wed, 07/23/2014 - 23:37

why my pictures are corrupted when i upload it?
Submitted byAnonymous (not verified)on Sat, 03/07/2015 - 15:34

helo a lot of thanks for you...ang dami mong natulungan dhil sa pg share ng mga codes lalong lalo ung ktulad ko na cs student..thank you talaga and GOD bless..
Submitted bySowmya RK (not verified)on Fri, 05/15/2015 - 16:24

Please anyone help me for multiple uploads, Its working fine for me . Thank you :)
Submitted bykolab webdesigner (not verified)on Thu, 10/29/2015 - 10:12

Now I understand about how to upload photo already I try to fix my error a lot of day but still not find my error when I saw your project and I do with you I had fix it . thank you so much .

sir argie, paano gawing mulitple pics ang eselect kasi 1pic lang puwede upload at kung paano create ng album then kapag na create na puwede ko eselect ang album at doon ko upload ang pics na gusto ko.thank you

Add new comment