Hello Devs,

In this tutorial, we are going to learn how to drag and drop file upload using dropzone js and php.

Follow this step by step guide given below:

Step 1 : 

Create index.php File 

<!DOCTYPE html>
    <title>Drag and Drop File Upload using Dropzone JS and PHP - Rathorji.in</title>
    <script src="http://demo.itsolutionstuff.com/plugin/jquery.js"></script>
    <link rel="stylesheet" href="http://demo.itsolutionstuff.com/plugin/bootstrap-3.min.css">
    <link href="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.0.1/min/dropzone.min.css" rel="stylesheet">
    <script src="https://cdnjs.cloudflare.com/ajax/libs/dropzone/4.2.0/min/dropzone.min.js"></script>

<div class="container">
    <div class="row">
        <div class="col-md-12">
            <h2>Drag and Drop File Upload using Dropzone JS and PHP - Rathorji.in</h2>
            <form action="upload.php" enctype="multipart/form-data" class="dropzone" id="image-upload">
                    <h3>Drag and Drop File</h3>

<script type="text/javascript">
    Dropzone.options.imageUpload = {
        acceptedFiles: ".jpeg,.jpg,.png,.gif"


Step 2 :

 Create upload.php File


$uploadDir = 'uploads';

if (!empty($_FILES)) {
 $tmpFile = $_FILES['file']['tmp_name'];
 $filename = $uploadDir.'/'.time().'-'. $_FILES['file']['name'];


Step 3 : 

Create upload folder Run this command:

php -S localhost:8000

Open this URL:


I hope this example helps you.