Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

How to reset the files-list? #1631

Closed
tptopu opened this issue Aug 29, 2012 · 9 comments
Closed

How to reset the files-list? #1631

tptopu opened this issue Aug 29, 2012 · 9 comments

Comments

@tptopu
Copy link

tptopu commented Aug 29, 2012

Hi there,

is there a function I can call from somewhere in my jquery-code that resets the file-list to 0 entries?
How can I access the object containing the file-list directly to get f.ex. the third entry?

Thanks

@d3xtro
Copy link

d3xtro commented Aug 31, 2012

<button id="clear_uploads" type="button" class="btn btn-info clear">
    <i class="icon-ok icon-white"></i>
    <span>Clear</span>
</button>
$(function () {
    $('#clear_uploads').click(function(){
        $('#fileupload table tbody tr.template-download').remove();
    });
});

@blueimp
Copy link
Owner

blueimp commented Sep 5, 2012

@blueimp blueimp closed this as completed Sep 5, 2012
@Pereitor
Copy link

I know this is not the place to ask it, but a simple answer besides a link the support guidelines would be great... The question is there, asked more than twice, but no answers. d3xtro approach isn't useful because it removes the rows from the table, but the file list is still full.

It's a pretty simple and common question for a common question/task. It should be explained clearly somewhere in the docs...

@d3x7ro
Copy link

d3x7ro commented Jun 12, 2013

$('.delete').click();

@Pereitor
Copy link

Thanks a lot for helping, d3x7ro. Unfortunately, it's not useful for me because I don't even have a "delete" button. I just plain need to empty the file list, which is not the same as firing the click event on that button. I already am using a similar approach than you - I delete the table rows of the uploaded files (in my case, just a single file). Then, after the file has been sent, I'd like to reset the list since I'm only allowing one file upload (limited via the "maxNumberOfFiles" option) and after it is selected it won't allow me to use any other one, no matter if they have been sent. I want to get rid of the delete button because my form only allows to upload one file each time the entire form is submitted, so there's no need for an extra cancel button: if the user wants to cancel the file upload, he/she just don't have to send the form.

By the way, I'm using the jQuery UI branch, which is a bit outdated.

@d3x7ro
Copy link

d3x7ro commented Jun 12, 2013

Why are you even using this library? Just use a normal file upload.

@Pereitor
Copy link

It's easy: I want/need to upload files through ajax.

@tomwade3
Copy link

tomwade3 commented May 5, 2014

Why are you even using a website for this? Just have them fax the file to you.

@guag
Copy link
Contributor

guag commented May 5, 2014

lol @ tomwade3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants