Drag And Drop File Upload with PHP MySQL and jQuery

Uploading files with a drag and drop feature is a user-friendly solution widely used on web Applications where the emphasis on usability is very high. Mostly we need to implement file uploading functionality by browsing the file directory through the click. But sometimes it is required to also handle file upload by drag and drop.
In this article, I will explain How to Implement drag and drop multiple file upload in PHP MySQL using jQuery. This is a very simple example, you can just copy-paste and change according to your requirement.
Before started to implement the Drag And Drop File Upload, look files structure:
  • upload-image-and-create-multiple-thumbnails-php
    • assets
      • dist
      • css
        • style.css
      • js
        • custom.js
      • uploads
      • img
    • templates
      • header.php
      • footer.php
    • index.php
    • DBConnection.php
    • upload.php
Step 1: Create the database and Table
For this tutorial, you need a MySQL database with the following table:
Step 2: Database Connection class
Create a controller file named DBConnection.php
Step 3: Include Dropzone Plugin Files
We have used Dropzone jQuery plugin for drag and drop file upload, include plugin files.
Step 4: Create action file named upload.php
Step 5: Create HTML file named index.php
We will create HTML file with drag and drop form.
Step 6: Create JavaScript file named custom.js
We will handle AJAX request
Create files named (header.php and footer.php)
This file contains the header and footer section of the webpage. The Bootstrap library is used to provide a better UI, so, include it in the header and footer section.
header.php
footer.php