Link to home
Get AccessLog in
Avatar of Aleks
AleksFlag for United States of America

asked on

DropZone - remove selected file

I am using DropZone with PureASP to upload multiple documents at once.
It works great, however if a user selects say 5 documents and then realizes one of them should not be uploaded, there is no option, checkbox or anything to remove it from the DropZone.  How can I do this ?

This is the script I am currently using:

 $(document).ready(function(){

            Dropzone.options.myAwesomeDropzone = {

                url: "attachments_add.asp?employerid=<%=Request.QueryString("employerid")%>&mode=upload",
                autoProcessQueue: false,
                uploadMultiple: true,
                parallelUploads: 20,
                maxFiles: 20,
				maxFilesize: 100,
				acceptedFiles: ".png,.jpg,.gif,.bmp,.jpeg,.tif,.tiff,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pps,.ppsx,.odt,.zip,.txt,.rtf",
				
                // Dropzone settings
                init: function() {
                    var myDropzone = this;

                    this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
                        e.preventDefault();
                        e.stopPropagation();
                        myDropzone.processQueue();
                    });
                    this.on("sendingmultiple", function() {
                    });
                    this.on("successmultiple", function(files, response) {
                        window.location.href="attachments.asp?employerid=<%=Request.QueryString("employerid")%>";
                    });
                    this.on("errormultiple", function(files, response) {
                    });
					
					
					
                }

            }

       });

Open in new window

Avatar of Big Monty
Big Monty
Flag of United States of America image

i think all you need to do it add

removeLinks: true

to your list of options:

url: "attachments_add.asp?employerid=<%=Request.QueryString("employerid")%>&mode=upload",
autoProcessQueue: false,
.......
removeLinks: true
Avatar of Aleks

ASKER

I added it but the only thing I see is an icon with a checkmark. It in fact adds the checkmark to files that have extensions that should not be allowed. And no option to remove it :(

User generated image
def Monday morning, try:

addRemoveLinks: true
Avatar of Aleks

ASKER

Same result as above. I see the green checkmarks but if I mouse over I don't have an option to remove any of the files
can you post the code for your entire dropzone object? I tested it out and it works here
Avatar of Aleks

ASKER

 <!-- DROPZONE -->
    <script src="../../includes/js/plugins/dropzone/dropzone.js"></script>


    <script>
        $(document).ready(function(){

            Dropzone.options.myAwesomeDropzone = {

                url: "attachments_add.asp?employerid=<%=Request.QueryString("employerid")%>&mode=upload",
                autoProcessQueue: false,
                uploadMultiple: true,
                parallelUploads: 20,
                maxFiles: 20,
				maxFilesize: 100,
				acceptedFiles: ".png,.jpg,.gif,.bmp,.jpeg,.tif,.tiff,.pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pps,.ppsx,.odt,.zip,.txt,.rtf",
				addRemoveLinks: true 

                // Dropzone settings
                init: function() {
                    var myDropzone = this;

                    this.element.querySelector("button[type=submit]").addEventListener("click", function(e) {
                        e.preventDefault();
                        e.stopPropagation();
                        myDropzone.processQueue();
                    });
                    this.on("sendingmultiple", function() {
                    });
                    this.on("successmultiple", function(files, response) {
                        window.location.href="attachments.asp?employerid=<%=Request.QueryString("employerid")%>";
                    });
                    this.on("errormultiple", function(files, response) {
                    });
                }

            }

       });
    </script>

Open in new window



BTW I am using Firefox
ASKER CERTIFIED SOLUTION
Avatar of Big Monty
Big Monty
Flag of United States of America image

Link to home
membership
This content is only available to members.
To access this content, you must be a member of Experts Exchange.
Get Access
Avatar of Aleks

ASKER

Monday indeed !   Thanks ! it works.
Avatar of Aleks

ASKER

Awesome!