How to upload image to MySQL database and display it using php

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ต.ค. 2024

ความคิดเห็น • 247

  • @denizasar87
    @denizasar87 2 ปีที่แล้ว +15

    11:33 Insert Database (Creating connectiondb.php)
    12:30 Connection to the database.
    ► Procedural style: mysqli_connect(host, username, password, dbname, port, socket)
    ► Object oriented style: new mysqli(host, username, password, dbname, port, socket)

    • @erick_faster
      @erick_faster 2 ปีที่แล้ว

      Hey dude, thanks for the video. I have a problem when I try to upload an image. what happens is that the image rotates 90 degrees to the left and I can't find a way to prevent that from happening. I hope you can help me, thank you very much.

  • @ryumawano9370
    @ryumawano9370 3 ปีที่แล้ว +29

    ITS WORKING OMG THANK YOU :( I PASSED MY EXAM BECAUSE OF YOU!

    • @okeoke4322
      @okeoke4322 3 ปีที่แล้ว +2

      Same here man. Thx for the tutorial

  • @kelongFX
    @kelongFX 3 ปีที่แล้ว +15

    It was one silent tutorial but I needed it ....have been stalling for years to do this ....I did it thanks men💪

    • @oldguy8177able
      @oldguy8177able ปีที่แล้ว

      same,you want code that does everything you want

  • @tebogomgidi9876
    @tebogomgidi9876 ปีที่แล้ว +2

    This was really helpful. I was struggling with another way to upload an image from another tutorial I was doing and images were not displaying but with your code it works perfectly.

  • @marcjacob11
    @marcjacob11 ปีที่แล้ว +1

    This is the BEST tutorial. Easy to follow and it works 100%! Thank you so much for this!

    • @CodingwithElias
      @CodingwithElias  ปีที่แล้ว

      Great to hear!

    • @friktogurg9242
      @friktogurg9242 6 หลายเดือนก่อน

      @@CodingwithElias I may have missed a few things, why does the code save into the Pc after upload?

  • @Pro_coder.007
    @Pro_coder.007 ปีที่แล้ว +2

    Thankyou very much lots of help bro, i seen lots of videos in TH-cam but not work but this video is awesome keep going bro ..😊❤

  • @sylakkayizzi8513
    @sylakkayizzi8513 2 ปีที่แล้ว +1

    yes yes yes yes, thanx so much u have simplified my task , this tutorial has seriously worked form me, am fully sorted now, thanx so much in deed. i will b waiting for more lessons

  • @tdarafalagi2382
    @tdarafalagi2382 ปีที่แล้ว

    Hi ela....I have big respect for you.....because I are real programer and TH-camr.....
    You don't hide ur knowledge ur source code.

  • @gabreturns917
    @gabreturns917 3 ปีที่แล้ว +5

    Great video! I have got few questions:
    1) Isnt that code exposed to MySQL Injection? How could I use prepared parametrized statements in your code?
    2)How to show the images upload into a table?
    3)How can I manage to rename the images I upload matching them to the AutoIncrement ID that mysql assigns to them?

  • @mosessakala8550
    @mosessakala8550 5 หลายเดือนก่อน +1

    Finally something that just works. Thanks a lot!

  • @shifahnamata485
    @shifahnamata485 2 ปีที่แล้ว

    Gal, this i can relate with, but thing is some people will not get it, like its strange and doesn't make sense to them. Honestly i have few friends, and my friends have shown me support in their own ways🤗❤️😇. But i get your point dear. Thanks for sharing

  • @YUhave2Bawsome
    @YUhave2Bawsome 3 ปีที่แล้ว +3

    Thanks for the tutorial, was just looking for something like this to help me out.

  • @jooryalhamed938
    @jooryalhamed938 2 ปีที่แล้ว +2

    Hi, you saved my life. Thank you so much for this clear and straightforward video, subscribed!

  • @Tawfig-Tamer
    @Tawfig-Tamer 2 ปีที่แล้ว +1

    Thank you, really it is very good and very clear 👍👍👍👍👍👍👍👍

  • @tunarmemmedov196
    @tunarmemmedov196 ปีที่แล้ว

    thank you:question ; if user insert image into database, will it also be inserted to uploads file that we also store like in the video ? or directly to dabatase without inserting into your file in your pc and then can be display in the page ?, because when i insert image,it's url also comes uploads, and it can be some user that want be upload image from their mobile,will it be work withour problem ? or we need to do another system ?

    • @CodingwithElias
      @CodingwithElias  ปีที่แล้ว

      To upload a file follow this two steps.
      1. the image/file/video must be uploaded to the server. in this case we used my pc as server.
      2. store the file location in to the database .

  • @s.b.mukesh4879
    @s.b.mukesh4879 3 ปีที่แล้ว +2

    Hello bro,
    I am going to do a project. Now I am design phase of it I want to know weather if we upload a file of word or xl or ... to a database(MySql) and can we access the file and it's related data using php.
    Please bro need a reply.

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว +1

      Check out my new Video "Online Book Store - Full PHP & MYSQL Project - Part 1
      " related to Your question

    • @s.b.mukesh4879
      @s.b.mukesh4879 2 ปีที่แล้ว

      Thank you for the reply

  • @jasonmenorca4362
    @jasonmenorca4362 3 ปีที่แล้ว

    Correct if im wrong. I think you just upload the new file name to the database? not the file it self. When you delete the image in the upload folder is it still you can display it ??

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      yeah.. but you can't upload file into database. instead store file name and extension in the database

  • @joyinmahmmadaslamlaskar3355
    @joyinmahmmadaslamlaskar3355 2 ปีที่แล้ว +1

    You are really an amazing programmer .

  • @DavidAshby1
    @DavidAshby1 3 ปีที่แล้ว +3

    Thanks for that. I have a question about the returned array at 5:25. Depending on which image file I select to upload I only get the name returned with a 1 at error rather than the zero returned with other images. The file throwing the 1 is a bog standard photo but I do not get any data in [type] =>
    [tmp_name] => because of the [error] => 1 but I cannot work out why. Any ideas please? Thanks again

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      checkout the source code under the description

    • @alihasafdar8256
      @alihasafdar8256 ปีที่แล้ว

      ​@@CodingwithEliasgive me the source code at one paste here i cant figure it out in description

  • @DiyintheGhetto
    @DiyintheGhetto 2 ปีที่แล้ว

    Hello, I have a question. Is it possible to generate a link after uploading the image? What I mean is I would like to upload a image to the database and have a link generated so when I go to that link it will display that image and nothing else?

  • @anusuyar8423
    @anusuyar8423 2 ปีที่แล้ว +1

    Thank you so much. Can you please post get and post method difference

  • @infinixhot3305
    @infinixhot3305 2 ปีที่แล้ว +1

    nice and thanks. with your effort i have succeeded.

  • @okaforchinyerematthew1937
    @okaforchinyerematthew1937 ปีที่แล้ว +1

    Bros i really thank you a lot for this video you put up, it is amazing and i appreciate it

  • @gtbmcollins1
    @gtbmcollins1 2 ปีที่แล้ว

    Thanks for this video. A couple of question for you though. Will this allow for very large files to be uploaded like videos? Can you upload from a mobile phone to the website using this code?

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว +1

      yes for sure, check out my video called, how to upload video using PHP and MySQL

  • @Eman0576
    @Eman0576 ปีที่แล้ว +1

    terimakasih banyak atas tutorialnya

  • @samboncay9776
    @samboncay9776 3 ปีที่แล้ว +1

    I got some errors, it's says
    "Warning: mysqli_connect(): The server requested authentication method unknown to the client [caching_sha2_password] in C:\xampp\htdocs\image-upload-php-and-mysql-main\db_conn.php on line 9
    Warning: mysqli_connect(): (HY000/2054): The server requested authentication method unknown to the client in C:\xampp\htdocs\image-upload-php-and-mysql-main\db_conn.php on line 9
    Connection failed! "

  • @akarshashamin1317
    @akarshashamin1317 2 ปีที่แล้ว +1

    Thanks a lot this really helps me to do my project 👍

  • @dhananjaychavan5540
    @dhananjaychavan5540 2 ปีที่แล้ว +1

    silent but great!!!!thank you very much

  • @joey7491
    @joey7491 ปีที่แล้ว +1

    thank you very much

  • @uttarakhandvloggerlifestyl922
    @uttarakhandvloggerlifestyl922 2 ปีที่แล้ว +1

    thanks for helping me

  • @shortclips400
    @shortclips400 ปีที่แล้ว

    Does it possible to upload cnic copy instead a pic for better security??

  • @dheerajn3314
    @dheerajn3314 3 ปีที่แล้ว

    Hello.
    Good work .. I have a qus. ....
    Jis trh se online examination form me Photo aur sign alg alg upload and display hota h wo kese hoga .... Plz samjhao

  • @sumanroshan2873
    @sumanroshan2873 ปีที่แล้ว +1

    Very nicely explained.Thanx

  • @rzstudio5204
    @rzstudio5204 2 ปีที่แล้ว +1

    Thank You So Much Sir

  • @vigneshvigneshbala3502
    @vigneshvigneshbala3502 7 หลายเดือนก่อน

    Sir i have a doubt,that uploaded img will be showed in other users id

  • @Timatej
    @Timatej ปีที่แล้ว

    i have a problem becouse my pictures does not show its just show picture logo and squer around how can i fix that and how can i incrise suported picture file size

  • @anninajose9035
    @anninajose9035 11 หลายเดือนก่อน +1

    Tnq so muchhhhh 😭😭😭

  • @DavidBr888
    @DavidBr888 2 ปีที่แล้ว +1

    isset($_FILES['my_image']) is not working for me :/ If im adding image, there is no Hello. Do you know why?

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว

      maybe you you forget to give a name for the input. like name="my_image" or enctype="multipart/form-data"

  • @قناةالشيخيوتيوبر
    @قناةالشيخيوتيوبر 3 ปีที่แล้ว +1

    simple and easy thanks alot

  • @Индрой
    @Индрой ปีที่แล้ว

    Really awesome u solved soo many problems

  • @sabinaanibassabinaanibas
    @sabinaanibassabinaanibas 3 ปีที่แล้ว +1

    The tutorial is great. I would like to know how to delete a picture once it's uploaded? Thank you in advance.

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว +1

      I'm making a tutorial on online book store. You question will be answered on that video. Thanks

  • @thesoftwareseeker
    @thesoftwareseeker 3 ปีที่แล้ว +1

    Thank you buddy for that it helps lot try to add your voice it will be easy for us to understand

  • @JohnDoe-rj9oy
    @JohnDoe-rj9oy 2 ปีที่แล้ว +1

    Thank you so much bro! It works

  • @primozdornik9791
    @primozdornik9791 ปีที่แล้ว +1

    Thank you!

  • @vaxff1945
    @vaxff1945 ปีที่แล้ว +1

    getting a error : Uncaught TypeError: strtolower(): Argument #1 ($string) must be of type string, array given in C:\xampp\htdocs\project\calender.php:55 Stack trace: #0 C:\xampp\htdocs\project\calender.php(55): strtolower(Array) #1 {main} thrown in

  • @bryanjonathan407
    @bryanjonathan407 11 หลายเดือนก่อน

    bro t at 11:09 i cant see the files that i uploaded in my uploads folder , i am using mac . can you help me bro?

  • @semirucucu7925
    @semirucucu7925 2 ปีที่แล้ว

    hey bro I'm at arround 11th minutes, I created a file 'uploads' and I can upload a jpeg file from website in this 'uploads' file (thanks to you), but when the image comes in file, it doesn't displaying, its saying 'maybe I don't have permission', do you know why is happening?

    • @chokhui4664
      @chokhui4664 ปีที่แล้ว

      Hello, I'm experiencing the same problem as you. Could you please tell me how you solved it?

  • @noordaniazulaikha8040
    @noordaniazulaikha8040 2 ปีที่แล้ว +1

    Hi Sir! I want to add the name of the person below the picture. how do I want to add in the upload.php section sir? Please help me sir. Urgent .

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว

      check out my new video called how to upload profile picture

  • @kamrangopalan7651
    @kamrangopalan7651 3 ปีที่แล้ว +1

    i have a login system and i want to insert the profile image inside the user table where there is the user information like the id how can i do this? cuss i have tried and when i upload it keeps adding new id's thanks :)

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว +1

      I'll make a video about that, thanks

  • @oumaimaoum5606
    @oumaimaoum5606 3 ปีที่แล้ว +1

    thank you

  • @chloeng804
    @chloeng804 2 ปีที่แล้ว

    Hey I would like to ask how to do editing? I want to upload a new picture and delete the old one

  • @itxxsaiff
    @itxxsaiff ปีที่แล้ว +1

    Wow That's Amazing

  • @johnharoldroxas2946
    @johnharoldroxas2946 2 ปีที่แล้ว +1

    Hello can you make a tutorial that if you click those picture it will redirect to another file? By the way this tutorial is great💕

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว +1

      Yeah, sure. You can just easily use a tag to do that. Thanks 👍

  • @abdelmajiedabusuliman4429
    @abdelmajiedabusuliman4429 ปีที่แล้ว

    what can I used in PDO method instead of ( mysqli_num_rows ) ??

    • @CodingwithElias
      @CodingwithElias  ปีที่แล้ว

      check out my PDO projects in this channel

  • @Anuj.Subedi
    @Anuj.Subedi 3 ปีที่แล้ว +1

    The files are uploaded and seen in uploads folder, but those images wont display on the webpage. Can you help please?

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      Checkout the source code under the description

    • @Anuj.Subedi
      @Anuj.Subedi 3 ปีที่แล้ว

      @@CodingwithElias I copied the the code and still same problem. Those uploaded images has the permission to read only though and it wont allow me to add permission for write and execute. Is this the issue or something else

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      @@Anuj.Subedi maybe this is your OS or server problem

    • @parrykhokhar2811
      @parrykhokhar2811 3 ปีที่แล้ว

      I had the same problem when I was using Kali Linux for this project. these are the steps I took. 1) open console in the uploads folder 2)put sudo su command 3) type this command chmod ugo+rwx uploads
      now you have applying read write and execute permissions for all users. should work now!

  • @-MdApu
    @-MdApu 2 ปีที่แล้ว

    Bro, if I do it on WAMPSERVER instead of using XAMPP, where should I create the uploaded file?

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว

      on your root directory/folder/ where you create index. php file

  • @monowersadaf
    @monowersadaf 3 ปีที่แล้ว +2

    thanks for the tutorial brother.

  • @IvairOsouza
    @IvairOsouza ปีที่แล้ว

    Hello friend, how can I use this code to upload 3 pictures directly from webcam android? I have 3 input to pictures and 1 to text, and 1 to username, can you help me?

  • @melisa-tl9mu
    @melisa-tl9mu 3 ปีที่แล้ว +1

    omg thankyou so much!! im gonna try this with our assignment its due in 2days skhdskfhd thanks

  • @duksisruksis
    @duksisruksis ปีที่แล้ว +2

    Info for Linux users. For me in beginning not working when I write my own code. :( After than I take source code from github and its not working :( After than I figure out. :) I must change permissions for folders where I want upload pictures. :) When I allow "Write " than it works :)

  • @mistysam6645
    @mistysam6645 2 ปีที่แล้ว +1

    so helpful thx 🌹👏

  • @pradumanpandey6065
    @pradumanpandey6065 2 ปีที่แล้ว +1

    Thanks bro

  • @adhilfairooz1003
    @adhilfairooz1003 3 ปีที่แล้ว +1

    thank you for explaining each every step

  • @reyvincentalcantara5563
    @reyvincentalcantara5563 2 ปีที่แล้ว

    how much is the storage limit of files that can be uploaded in mysql

  • @Timatej
    @Timatej ปีที่แล้ว

    do i need to open 21 port for ftp or?

  • @yasserrazzaki7235
    @yasserrazzaki7235 2 ปีที่แล้ว +1

    A perfect tutorial ! you're the best, all the luck !

  • @anasaljawa858
    @anasaljawa858 3 ปีที่แล้ว +1

    Thanks

  • @mfs6165
    @mfs6165 3 ปีที่แล้ว +1

    Thank you love 💞💖💖💖💞💖💖💞🤗🤗

  • @yehannk448
    @yehannk448 2 ปีที่แล้ว +1

    thanks so much can you explain about the header('location:index.php?error=$em');

    • @CodingwithElias
      @CodingwithElias  2 ปีที่แล้ว

      Just making redirect.
      Redirect to index .php and passing query error message

  • @InfiniteLK
    @InfiniteLK ปีที่แล้ว

    Thanks a lot😍 bro

  • @maishaalam658
    @maishaalam658 ปีที่แล้ว +1

    Good

  • @stephanpetersen3600
    @stephanpetersen3600 3 ปีที่แล้ว +2

    Thanks for this great tutorial!

  • @mentor-abdullah
    @mentor-abdullah ปีที่แล้ว

    One of best

  • @minternetcafe7850
    @minternetcafe7850 4 ปีที่แล้ว +2

    good

  • @suvethachandramohan2468
    @suvethachandramohan2468 3 ปีที่แล้ว

    can u pls tell me how to check the image dimension
    u have given the validation of image size...
    I too need to check image dimension how to do that

  • @GAMEZONELITE
    @GAMEZONELITE 3 ปีที่แล้ว +1

    How do you make it so that the image uploaded is on the same page as the upload button, not on another page?

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      make action="" copy past the code from the other page

  • @cristianjaysino570
    @cristianjaysino570 3 ปีที่แล้ว

    Is there any ways to upload an image without using and formdata() function and just use a post

  • @jomcabanilla3732
    @jomcabanilla3732 ปีที่แล้ว

    so is the picture going to be uploaded to your database or what? i only see urls?

    • @CodingwithElias
      @CodingwithElias  ปีที่แล้ว

      The picture uploaded into the server and the url inserted into the database

  • @clarkykuuun937
    @clarkykuuun937 3 ปีที่แล้ว +1

    YOU SAVE ME FROM HELL THANKS ELIASSSSSSSSSS

  • @bernadettefernando1762
    @bernadettefernando1762 3 ปีที่แล้ว +1

    Thanks a lot this helps a lot

  • @Juan-rb5uv
    @Juan-rb5uv 3 ปีที่แล้ว +1

    Friend you can upload 5 to 6 images with the same self-increasing id

  • @shaileshkumar-qf6bd
    @shaileshkumar-qf6bd 3 ปีที่แล้ว

    Img with extension very nice

  • @joyinmahmmadaslamlaskar3355
    @joyinmahmmadaslamlaskar3355 2 ปีที่แล้ว +1

    Amazing

  • @AliHamza-pi7zm
    @AliHamza-pi7zm ปีที่แล้ว

    very nice

  • @focusontheroad5190
    @focusontheroad5190 3 ปีที่แล้ว +1

    silent but effective!

  • @abdellatif.x8127
    @abdellatif.x8127 2 ปีที่แล้ว +2

    Thanks man 🧡

  • @leefelix6469
    @leefelix6469 4 หลายเดือนก่อน

    YOU ARE A SAVIOUR

  • @themiyajayakodi4052
    @themiyajayakodi4052 3 ปีที่แล้ว +1

    how to fetch image form database relevent unique image to diplay, example - profile picture

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว +1

      Check out my chat app tutorial, all explained

  • @HuyNguyen-cz8md
    @HuyNguyen-cz8md 2 ปีที่แล้ว +1

    From team 6 with love

  • @thearmor9231
    @thearmor9231 3 ปีที่แล้ว +1

    Nice

  • @greenbranch8383
    @greenbranch8383 2 ปีที่แล้ว

    thank you very much but still the photo can't be appeared even though i copied and pasted the codes it says
    Warning
    : mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in
    C:\xampp\htdocs\dashboard\insert images\view.php
    on line
    35

  • @leahkuria5210
    @leahkuria5210 7 หลายเดือนก่อน

    After uploading the video, how can i make the video to be liked and commented on by other users

  • @abidniazmalik3417
    @abidniazmalik3417 2 ปีที่แล้ว +1

    well done brother

  • @frzlr7
    @frzlr7 2 ปีที่แล้ว +1

    good video, very helpful! Keep it up.

  • @camilleschori
    @camilleschori 3 ปีที่แล้ว +2

    Thank u so much u saved my life lol

  • @asmitaoli7850
    @asmitaoli7850 3 ปีที่แล้ว +1

    My url is not seen in database because of which i am not able to retrieve the photos

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      We're not inserting the image URL alternatively we're inserting the image name and extention

  • @kevinwhite6300
    @kevinwhite6300 ปีที่แล้ว

    Heii great video but how can I make a userid for the upload ?

    • @CodingwithElias
      @CodingwithElias  ปีที่แล้ว

      Check out my video called " how to upload profile picture"

  • @rothdara4092
    @rothdara4092 3 ปีที่แล้ว

    Thank u video for me sir
    Cloud you tell me about parameter error,

    • @rothdara4092
      @rothdara4092 3 ปีที่แล้ว

      Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in C:\xampp\htdocs\upload-image\view.php on line 14
      --------
      View

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      Updated your server to php 7 or greater

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      And mysql to mysqli support version

  • @naufalfarisfadhil1246
    @naufalfarisfadhil1246 3 ปีที่แล้ว

    thanks for tutorial but my file not show in folder but in database is show, how i fixed it?

    • @CodingwithElias
      @CodingwithElias  3 ปีที่แล้ว

      Checkout the code under the description

  • @shihabali1509
    @shihabali1509 2 ปีที่แล้ว +1

    Are those images downloadable?