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

ASPjQueryWeb Development

Avatar of undefined
Last Comment
Aleks

8/22/2022 - Mon
Big Monty

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
ASKER
Aleks

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 :(

Capture.PNG
Big Monty

def Monday morning, try:

addRemoveLinks: true
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER
Aleks

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
Big Monty

can you post the code for your entire dropzone object? I tested it out and it works here
ASKER
Aleks

 <!-- 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
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
ASKER CERTIFIED SOLUTION
Big Monty

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Aleks

Monday indeed !   Thanks ! it works.
ASKER
Aleks

Awesome!