Link to home
Start Free TrialLog in
Avatar of ITsolutionWizard
ITsolutionWizardFlag for United States of America

asked on

dropzone example

http://www.dropzonejs.com/examples/simple.html

I use above webpage to attach the file. but how to remove the file that already uploaded?
Avatar of leakim971
leakim971
Flag of Guadeloupe image

Just use :
$(".dropzone").dropzone.removeAllFiles(true);

Open in new window


So, for example, with a button :
<button onclick="removeMyFiles()">remove files</button>
<script>
var removeMyFiles = function() {
      $(".dropzone").dropzone.removeAllFiles(true);
}
</script>

Open in new window

Avatar of ITsolutionWizard

ASKER

The drop zone inside of div has each upload picture and when the picture is mouse over, it shows [x]
And i hope I can make deleting the picture by a click on image

I don't think your solution work
ASKER CERTIFIED SOLUTION
Avatar of Chinmay Patel
Chinmay Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I will call ajax/Jquery to get something done with the server side. so you do not have to worry about server call.
In that case, refer to my answer in other post

<script src="dropzone.js"></script>
<div class="submit-section">

    <form action="/Home/Upload/" class="dropzone" id="myAwesomeDropzone"></form>
</div>

<script>
    Dropzone.options.myAwesomeDropzone = {
        init: function () {
            this.on("removedfile", function (file) {
                alert("CODE of the AJAX function to delete file from server.");
            });
        }
    };
</script>

Open in new window

it shows [x]

The "X" you're seeing is an icon when it fail to upload, not a button to remove the picture
 User generated image
If you really want to use one of these "icon" to remove :
$(".dz-success-mark,.dz-error-mark").click(function() { // success or error
     $(".dropzone").dropzone.removeAllFiles(true);
});

Open in new window