How to Use Webcam in PHP Using HTML5 and Save Image to Database

Hello Friends recently i have added a Tutorial about How to use Webcam in PHP and Save Image to Database using Mysqli. Earlier tutorial using the Flash Plugin for showing the Webcam and clicking the Image.

Today i am uploading another tutorial for How to use Webcam in PHP using HTML5, Jquery and Save Image to Database using Mysqli. This tutorial is slightly different from the previous tutorial as this tutorial will use the HTML5 for showing the Webcam.

Design Part for showing the webcam window and button to capture

Script part for Showing Webcam, Button Click working and Saving the Image to Database

 You can Download the files or tutorial from Github – Click Here

Thank You for reading the tutorial If you like the tutorial than please please Share it. If you have any comment than let me know comment below.



  1. Thank you for this great info. Have you every considered to extend this with .pdf capability? So you can use the webcam to take a photo, but convert it to .pdf and save it as a document.

  2. Hi,
    Thanks for the tutorial but I am getting error.
    “You have denied camera access.”
    I don’t know why?.

  3. Hi Vivek
    Need one urgent help.
    After deploying your code ,capturing photo through webcam is working fine and appreciated your efforts on this.
    One conflict I faced,after capturing one photo,Webcam console is getting fixed not unable to check Live Cam during further capture.
    Could you please able to help on this.


  4. thank you for the tutorial. but i have a little nit problem. when i snap the picture, the image name does not have in database.

  5. Hi there friends, how is everything, and what you wish for to say concerning this paragraph,
    in my view its truly amazing for me.

    • Fredrik Brandt

      October 21, 2017 at 17:58

      Hi and thanks for a great feature,
      I wonder however how I can save the image to my own db-table.
      I would like to add the image to my own table but imagelist only contains the image and filename with path saved to disc in a non-usable format.
      I want to get the filename (or picture) into a variable (or screen value) and use this in my instert-routine.
      How is this possible? I tried the underlaying php, without luck.

Leave a Reply

Your email address will not be published.