In this tutorial, We will learn how to remove uploaded files. It's a simple example of dropzone delete the uploaded file.

Create some files & folder:

  • index.php
  • upload.php
  • upload folder


<!DOCTYPE html>
  <title>How to Delete Uploaded File in Dropzone JS?</title>
  <script src=""></script>
  <link rel="stylesheet" href="">
  <link href="" rel="stylesheet">
  <script src=""></script>
<div class="container">
  <div class="row">
    <div class="col-md-12">
      <h2>How to Delete Uploaded File in Dropzone JS</h2>
      <form action="upload.php" enctype="multipart/form-data" class="dropzone" id="image-upload">
        <input type="hidden" name="request" value="add">
          <h3>Upload Multiple Image By Click On Box</h3>
<script type="text/javascript">
    Dropzone.autoDiscover = false;
    var myDropzone = new Dropzone(".dropzone", { 
       maxFilesize: 10,
       acceptedFiles: ".jpeg,.jpg,.png,.gif",
       addRemoveLinks: true,
       removedfile: function(file) {
         var fileName =; 
           type: 'POST',
           url: 'upload.php',
           data: {name: fileName,request: 'delete'},
           sucess: function(data){
              console.log('success: ' + data);
         var _ref;
          return (_ref = file.previewElement) != null ? _ref.parentNode.removeChild(file.previewElement) : void 0;


$uploadDir = 'upload';
if ($_POST['request'] == "add") {
    if (!empty($_FILES)) {
     $tmpFile = $_FILES['file']['tmp_name'];
     $filename = $uploadDir.'/'.$_FILES['file']['name'];
    $fileName = $uploadDir.'/'.$_POST['name'];  

Finally, Create upload folder and run your application.