How To Upload Image Into MySQL Database & Display It Using PHP With Validation | PHP & MySQL

Поделиться
HTML-код
  • Опубликовано: 16 дек 2021
  • How To Upload Image To MySQL Database With Validation & Display It Using PHP & MySQL | PHP & MySQL for Beginners
    More Videos from David G Tech :
    - Create Login & Registration Form with Logout & Login Session Using PHP & MySQL | PHP for Beginners = • Create Login & Registr...
    - Custom Input Type File Upload Button Using HTML & CSS = • Custom Input Type File...
    Contact :
    GitHub = github.com/davidgrcias​
    Instagram = / davidgrcias​
    Gmail = davidgarciasaragih7@gmail.com
    Donate To Support :
    - paypal.me/davidgtech
    - sociabuzz.com/davidgtech/donate
    Music :
    1. Track: Vaance & Deerock - Electric (feat. Robbie Rosen) [NCS Release]
    Music provided by NoCopyrightSounds.
    Watch: • Vaance & Deerock - Ele...
    Free Download / Stream: ncs.io/Electric
    2. Track: Tobu - Lost [NCS10 Release]
    Music provided by NoCopyrightSounds.
    Watch: • Tobu - Lost | House | ...
    Free Download / Stream: ncs.io/TLost
    3. Track: Jim Yosef, Electro-Light, Anna Yvette, Deaf Kev & Tobu - Destiny [NCS10 Release]
    Music provided by NoCopyrightSounds.
    Watch: • Jim Yosef, Electro-Lig...
    Free Download / Stream: ncs.io/Destiny
    4. Track: Jim Yosef, Electro-Light, Anna Yvette, Deaf Kev & Tobu - Destiny [NCS10 Release]
    Music provided by NoCopyrightSounds.
    Watch: • Jim Yosef, Electro-Lig...
    Free Download / Stream: ncs.io/Destiny
    Source Code = drive.google.com/drive/folder...
    -----------------------------
    Tags :
    upload images to website, store to database & display it with validation using php & mysql,upload images to website, store to mysql database & display it with validation using php & mysql | php & mysql for beginners,upload image php,upload image in php mysql,upload image to database,upload file images in php,upload file in php,upload file in php mysql,file upload preview image html php,upload onlu image file,how to upload image file in php, file/image upload in php,how to upload image file using php and mysql, file upload and display image in php mysql, file upload and display image in php,upload image in website,upload image to website using html,upload image to website usinhg php,how to upload image in website using php,upload image to website using html, upload image website,how to upload jpeg image to website,how to upload image in website using mysql and php,how to upload png image to website php, how to upload image in php,store image in database,store image in mysql database php, image upload in php,image upload in html form, image upload validation in php, file image upload validation in php,upload with image validation in php,image validation php mysql, image validation in php, how to make image validation in php,how to create image validation in php,image validation php mysql,how to upload image to mysql database and display it using php,how to upload image to mysql database and display it using php in easy way,how to insert images to mysql and display it/them usinhg php mysql, upload files and images to website in php,php tutorial for beginners,php tutorial,php for beginners,upload image to mysql database using php only,how to upload and store images in mysql database,upload image, how to upload image into mysql database and display it on web page using php and with validation,upload and store an image in the database with php,upload and store image file in database using php and mysql, upload made easy in php,how to insert image into database in php,how do i store images in mysql,how do i store images in sql,how do i store images in database,php file upload, php image file upload, upload image in database and save image in folder,how to upload / insert an image into database using php mysql,how to upload image in database using php mysql,upload image using php,upload an image with php,upload image to database adding an image to the website,upload php and mysql image database, how to upload multiple image in php and store in mysql,upload image to database php mysql,how to insert image in laravel,upload image in folder and database in php mysql easiest php tutorial,upload and display multiple images using php mysqli,upload images to mysql phpmyadmin,upload images in php and display uploaded image,multiple image upload and display using php,how to upload image and display image in php with validation,validate image when uploading image to php,how to store image in mysql database using php,image upload in php with database,database image, image database, image database file,image mysql database,image gallery php mysql database,,upload image using php,mysqli database and php image,how to upload image in php and store in database mysql,how to upload image in php,php upload images to mysql database,mysql database tutorials for beginners,php,mysql,database,image upload,how to upload image file in php

Комментарии • 91

  • @jimmytrix
    @jimmytrix 2 месяца назад +1

    this helped me alot. i was struggling for hours on how to do this heck i didnt even know the proper syntax. thank you!

  • @fxdeking
    @fxdeking Год назад +2

    mantap, sangat bermanfaat

  • @user-kc8sh3rr5e
    @user-kc8sh3rr5e 9 месяцев назад +6

    Great Problem solving skills. Thanks for making this video ....

    • @DavidGTech
      @DavidGTech  9 месяцев назад +1

      Thank you so much for your kind words! I'm really glad to hear that you found the video helpful and that it helped you improve your problem-solving skills. If you have any more questions or if there's anything specific you'd like to see in future videos, please don't hesitate to let me know. Your feedback and suggestions are greatly appreciated. Thanks again for watching!

  • @rome3885
    @rome3885 23 дня назад

    thank you very much good sir

  • @MohitKumar-jg4ry
    @MohitKumar-jg4ry 2 года назад +3

    thank you, for the information you share.

    • @DavidGTech
      @DavidGTech  2 года назад

      You're welcome!!! Thank you for watching...

  • @danielxzmlvn
    @danielxzmlvn Год назад +2

    Really Really thank you God bless you!!!

    • @DavidGTech
      @DavidGTech  Год назад +1

      You're much welcome! God bless you too.

  • @ahmedhasan4893
    @ahmedhasan4893 Год назад +1

    tysm sirr, thanks alot ur video helped me alot thnx

    • @DavidGTech
      @DavidGTech  Год назад

      You're very welcome! I'm thrilled to hear that the video was helpful to you and that you found success with the image upload and display using PHP and MySQL. If you have any more questions or need further assistance, feel free to ask. Keep up the great work, and happy coding!

  • @arunkumar-mm2nf
    @arunkumar-mm2nf 2 года назад +3

    thanks for this video.. very usefull

    • @DavidGTech
      @DavidGTech  2 года назад

      You're welcome!!! Thanks for watching...

  • @khalilbassem8094
    @khalilbassem8094 Год назад +1

    Thank you very much for your video its help me

    • @DavidGTech
      @DavidGTech  Год назад +1

      You are welcome!!! Thanks for watching!!!

  • @geraldinkaba5329
    @geraldinkaba5329 Год назад +3

    Thank you very much🙏

  • @keertibhovi3727
    @keertibhovi3727 2 года назад +3

    Thank you so much🙂

  • @user-zz7ku1od7u
    @user-zz7ku1od7u 6 месяцев назад

    thanks great problem solving

  • @user-tq1ol4xj2e
    @user-tq1ol4xj2e 4 месяца назад +1

    Thank you boss

    • @DavidGTech
      @DavidGTech  2 месяца назад

      Hi @user-tq1ol4xj2e,
      You're welcome! 😊 Any time!

  • @yoursricky6705
    @yoursricky6705 Год назад +3

    thank u dear ......

    • @DavidGTech
      @DavidGTech  Год назад +1

      You're welcome!!! Thanks for watching...

  • @Maram_71
    @Maram_71 9 месяцев назад +3

    God bless you Thank you for this amazing video 🙏🏾 I have q, can we do the same way for pdf files?
    I mean when user upload pdf file can I as admin see the content of the pdf file? Thank you again.

    • @DavidGTech
      @DavidGTech  8 месяцев назад

      Thank you so much for your kind words and blessings! 🙏🏾 I'm glad you found the video helpful.
      Regarding your question, the process for handling PDF files is slightly different, but it's definitely possible. You can create a similar system where users can upload PDF files, and as an admin, you can access and view the content.
      For security and privacy reasons, it's important to implement proper validation and handling mechanisms to ensure that only authorized individuals can access sensitive information within the PDFs.
      If you're interested, I can create a tutorial on how to implement this feature with PDF files. Let me know if that would be helpful to you and others in the community.
      Thanks again for your support! 🙌

  • @chris-zlrr
    @chris-zlrr 2 года назад +9

    u just saved so many braincells of me

    • @DavidGTech
      @DavidGTech  2 года назад +2

      Haha, good for you.
      Thank you for watching...

  • @syedumar3806
    @syedumar3806 Год назад +1

    thank you

    • @DavidGTech
      @DavidGTech  Год назад +1

      You're very welcome. Thanks for watching!!!

  • @dejannikolic2237
    @dejannikolic2237 2 года назад +2

    Hello, thanks for this video. I would ask you for help. The picture that I uploaded I put in the DIV tag.Below the picture in that DIV is a button-bootstrap modal.I want that when I click on the button, some information about the image appears on the screen.but the problem is that I only get the data for the last uploaded image.how the button displays information about the image that was clicked.Thanks.

    • @DavidGTech
      @DavidGTech  Год назад +1

      Thank you for your comment and I'm glad you found the video helpful!
      Regarding your question, I understand that you're facing an issue with the Bootstrap modal displaying information about the image that was clicked, and currently, it only shows data for the last uploaded image. To make the button display information about the specific image that was clicked, you'll need to modify the code in your PHP and JavaScript files.
      Here's a general approach you can follow to achieve this:
      - In your PHP file (responsible for uploading images and saving data to the database), make sure to save an identifier for each uploaded image in the database, such as its filename, a unique ID, or any other reference that can uniquely identify the image.
      - In the same PHP file, include this identifier as a custom attribute (e.g., data-image-id) in the HTML markup for each image that is being displayed on the page. This way, when you render the images on your webpage, they will have this unique identifier associated with them.
      - In your JavaScript file, write a function that handles the click event of the button in the Bootstrap modal. When the button is clicked, retrieve the value of the data-image-id attribute from the corresponding image, and use this ID to fetch the relevant information from the database (using AJAX, for example).
      - Once you have the information, dynamically update the content of the Bootstrap modal with the relevant details, such as image description, title, or any other data associated with the clicked image.
      If you need more specific help with the code implementation, feel free to ask. Good luck with your project, and I hope this helps you resolve the issue!

  • @kylerequez1315
    @kylerequez1315 Год назад +2

    Hi thank you for this video, why does it echo "Image File Size is Too Large" when the database adds the image inside the table?

    • @DavidGTech
      @DavidGTech  Год назад

      That means your image file size is exceed the maximum file size that have been set in the code

    • @richardgideon4959
      @richardgideon4959 10 месяцев назад

      Bro pls send me the source code

    • @amitmeerchandani4704
      @amitmeerchandani4704 9 месяцев назад

      check description@@richardgideon4959

  • @jagtishkumarsundararaman6089
    @jagtishkumarsundararaman6089 Год назад +1

    hello, thanks for this video, I would ask you for help. I have problem with the coding on the upload image. the image was save on the database but the file name does not appear on the database .

    • @DavidGTech
      @DavidGTech  Год назад

      I'm glad you found the video helpful! Regarding the issue you're facing with the file name not appearing in the database after uploading the image. Please review the PHP codes that responsible for uploading the image and saving the file name in the database. Make sure you are correctly capturing the file name and inserting it into the appropriate database column. Verify that you are using the correct variable or value to store the file name in the database.

  • @hmifjk
    @hmifjk 8 месяцев назад

    mine shows undefined array key image what is that

  • @user-ze7sx5ul5k
    @user-ze7sx5ul5k Год назад +3

    makasi banyak ya kak... semoga sekeluarga selalu dalam lindungan tuhan yang maha kuasa😇🙏

    • @DavidGTech
      @DavidGTech  Год назад

      Iya, sama-sama. Aminn. GBU!!!

    • @muliayasman471
      @muliayasman471 5 месяцев назад

      bg, saya kok ngestuck di No such file or directory in bg@@DavidGTech

  • @nurbainggit
    @nurbainggit Год назад +2

    Makasih bng

  • @themidev
    @themidev Год назад +3

    100% working

    • @DavidGTech
      @DavidGTech  Год назад +2

      Great!!! Thanks for watching!!!

  • @haileeko1952
    @haileeko1952 Год назад +1

    thanks

    • @DavidGTech
      @DavidGTech  Год назад +1

      You're welcome! Thanks for watching!!!

  • @dhruvsharma1172
    @dhruvsharma1172 3 месяца назад +1

    thankyou bro, can you tell me how to call these images dynamically to my code

    • @DavidGTech
      @DavidGTech  2 месяца назад

      Hi @dhruvsharma1172,
      Thank you! 😊 To call images dynamically in your code, you can store the image paths in your database and retrieve them using PHP. This way, you can loop through the database records and display each image accordingly. I'll consider making a tutorial on this. Stay tuned!

  • @helenamedeiros8601
    @helenamedeiros8601 Год назад +1

    hey, i just copied the code from your gdrive folder, and created the database just like yours, but when i upload the imagem i cant see it, i just see the name of the file. :( could someone help me?

    • @DavidGTech
      @DavidGTech  Год назад

      Make sure that all of your codes are and database (including table and field name) fully correct. You can download the source code (including the database) in the description of video. Thanks.

  • @cuongdo2819
    @cuongdo2819 9 месяцев назад +1

    Thank you very much

    • @DavidGTech
      @DavidGTech  8 месяцев назад

      You're very welcome!!!

  • @user-sr5yn3cj1p
    @user-sr5yn3cj1p 5 месяцев назад

    Great tutorial, but in php7.4 the data.php, there is an error :>--"Warning: Invalid argument supplied for foreach() in ..\uploadimagefile\data.php on line 22"-- seems need to be reprogram that part. can you help with that>.Thanks

    • @DavidGTech
      @DavidGTech  2 месяца назад

      Hi @user-sr5yn3cj1p,
      Check if the variable $data is an array before using foreach to avoid the warning. Here’s an example:
      if (is_array($data)) {
      foreach ($data as $item) {
      // Your code here
      }
      } else {
      echo "No data available";
      }

  • @markjosephignacio4678
    @markjosephignacio4678 Год назад

    Sir i have a question, do i need to create a designated folder for all the image i want to upload? i can insert all the data in the data base but when i try to view it at my the website image cant be posted there? or how can i fix it ?

    • @DavidGTech
      @DavidGTech  Год назад

      Yes, to display the uploaded images on your website, you typically need to create a designated folder to store the uploaded images. Here's what you can do to fix the issue:
      1. Create a folder: Choose a location on your web server where you want to store the uploaded images. Create a folder in that location, and make sure it has appropriate read and write permissions so that the web server can access and store the images in it.
      2. Update file paths: In your PHP code, ensure that you are correctly specifying the file path to the folder where the images are stored. Update the file paths in your code to match the folder structure and location you created in step 1. This allows your PHP code to save the uploaded images to the designated folder.
      3. Displaying the images: When retrieving and displaying the images on your website, ensure that you are using the correct file paths to access the images from the designated folder. Check that the paths in your HTML or PHP code point to the correct location where the images are stored.

    • @footballclips5013
      @footballclips5013 Год назад

      ​@@DavidGTech it uploads the image to the database but it doesn't store it in any folder

  • @vidyasagarv8168
    @vidyasagarv8168 2 месяца назад

    Sir, please make a video multiple images CRUD in php? Please 🎉

  • @sk.rahathossain3084
    @sk.rahathossain3084 2 года назад +3

    Thanks a lot.I do it at my first try after watching your video

    • @DavidGTech
      @DavidGTech  2 года назад

      Nice! You're welcome bro

  • @shabnam4152
    @shabnam4152 2 года назад +1

    Sir aap background music lganai ki jugah code ko smjhao taki humein bhi smjh aye yeh kesai work karta hai

  • @artcraftlover3082
    @artcraftlover3082 4 месяца назад +1

    Hey, i want to Upload images in my server, not in my Computer Folder ,?????

    • @DavidGTech
      @DavidGTech  2 месяца назад

      Hi @artcraftlover3082,
      To upload images to your server instead of a local folder, you need to specify the server directory path in your PHP code. Make sure your server has write permissions for the directory where you want to save the images. Hope this helps! 😊

  • @HDROID
    @HDROID 2 года назад +1

    i have a question, why when i upload a image doesnt show just show the image name

    • @DavidGTech
      @DavidGTech  2 года назад

      It looks like there are some missing codes in your code. Make sure your code is fully complete like in the video

    • @HDROID
      @HDROID 2 года назад +1

      @@DavidGTech ok thanks

    • @DavidGTech
      @DavidGTech  2 года назад

      You're welcome!!

  • @dmerryshyllachannel5782
    @dmerryshyllachannel5782 Год назад

    Sir, i have one problem when i view my website it appear only the name of image, how can i create a forder for that i have uploaded successful? Please answer my question

    • @dmerryshyllachannel5782
      @dmerryshyllachannel5782 Год назад

      Inside your code in index. Php what about document. location. href inside script... I don't understand

    • @DavidGTech
      @DavidGTech  Год назад

      Hello! It seems like you are facing an issue where only the name of the image is being displayed on your website, and you would like to create a folder to store the uploaded images. I can help you with that!
      To resolve this, you can follow these steps:
      1. Create a folder on your server where you want to store the uploaded images. You can do this either through your hosting provider's file manager or by using an FTP client.
      2. After creating the folder, make sure to set the appropriate permissions for it. Generally, you can set the folder's permissions to allow read, write, and execute access for the web server. This ensures that the server can store and retrieve files from that folder.
      3. Update your PHP code that handles the image upload to save the uploaded image to the newly created folder. You will need to modify the code that specifies the destination directory for the uploaded file. Instead of just using the filename, include the folder path as well. For example, if your folder is named 'uploads,' you can specify the destination directory as 'uploads/filename.jpg' or 'path/to/uploads/filename.jpg,' depending on the folder structure.
      4. Finally, update your website code that displays the images to include the folder path as well. In your HTML code, make sure that the 'src' attribute of the image tag points to the correct folder and filename. For example, if your image is stored in the 'uploads' folder, the 'src' attribute should be something like 'uploads/filename.jpg.'
      By following these steps, I hope you can be able to store the uploaded images in a specific folder and display them correctly on your website. Thank you!

    • @DavidGTech
      @DavidGTech  Год назад

      In JavaScript, document.location.href is a property that returns the complete URL of the current webpage. It can also be used to redirect the browser to a different URL

  • @abhishekdubey94246
    @abhishekdubey94246 Год назад +1

    only one file is uploaded. i am not able to upload more than one file

    • @DavidGTech
      @DavidGTech  Год назад +2

      I have made the tutorial video to upload more than one file. You can watch this = ruclips.net/video/KRhLh8UiYjk/видео.html
      Thanks for watching!

  • @Preshdev
    @Preshdev 2 года назад +1

    jah bless

  • @user-cp4zc7bs9s
    @user-cp4zc7bs9s 8 месяцев назад +1

    Bruh i subscribe to you ,can you can add some Css for this code.

    • @DavidGTech
      @DavidGTech  8 месяцев назад +1

      Hey @user-cp4zc7bs9s,
      Thanks a ton for subscribing! 🚀 While I won't provide the CSS directly, you can find fantastic design inspiration on platforms like CodePen (codepen.io) and CSS-Tricks (css-tricks.com). Search for "upload form" or "file input design," and you'll discover a variety of styles to suit your taste.
      Feel free to explore these resources and integrate a design that resonates with your website's vibe. If you run into any issues or have questions along the way, I'm here to help!
      Happy coding! 😊🎨

  • @lebrongerms4797
    @lebrongerms4797 2 года назад +1

    Source code? Please

  • @bocoraninfoslothariini
    @bocoraninfoslothariini Год назад

    hai kak apakah ini aman dari shell code inject kak?

    • @DavidGTech
      @DavidGTech  Год назад

      Denger2 sih katanya lebih baik pakai PDO untuk koneksi PHP ke MySQLnya itu

    • @bocoraninfoslothariini
      @bocoraninfoslothariini Год назад

      @@DavidGTech baik mas terimakasih informasinya

  • @DanielNazarioOliveiraDeSouza
    @DanielNazarioOliveiraDeSouza 6 месяцев назад +1

    One video, sem voz

    • @DavidGTech
      @DavidGTech  2 месяца назад

      @DanielNazarioOliveiraDeSouza
      Olá! Se precisar de legendas ou alguma forma de compreender melhor o conteúdo do vídeo, sinta-se à vontade para pedir ajuda. Estou aqui para ajudar da melhor maneira possível!

  • @bijoyadas7322
    @bijoyadas7322 11 месяцев назад

    This codes r suffeled, so we can't see... Please!!! Work on this, then it will be helpful for others...

    • @DavidGTech
      @DavidGTech  8 месяцев назад +1

      Hi @bijoyadas7322,
      Thank you for your feedback, and I appreciate your input. I apologize for any confusion caused by the arrangement of the code.
      To make it more accessible and easier to follow, I'll work on organizing the code better in the video description or as a pinned comment. This should help others navigate through the code seamlessly.
      I appreciate your patience, and I'll make the necessary improvements as soon as possible. If you have any specific questions in the meantime or need clarification on any part of the code, please feel free to ask.
      Thanks for bringing this to my attention, and I'm committed to making the tutorial as helpful as possible for everyone.

  • @erpetek
    @erpetek 2 месяца назад +1

    oops, i think i just called my file '); DROP TABLE `users`; -- on accident 😇