jQuery MultiFile - how to clear / reset?
-
18-09-2019 - |
Question
I'm using the jQuery multi-file upload plugin found here:
http://www.fyneworks.com/jquery/multiple-file-upload/
I don't see in any of the examples though a way to "reset" the file-picker, clearing out any currently selected items.
Any one know how to do this? Thanks!
Solution 3
For anyone interested, I uploaded my multi-file here. I wound up rolling my own, because I could not get this plug-in to work.
I had to cull a lot out of the file that was specific to the client, but the important stuff for the file upload should all be there. I did NOT include the upload library for parsing the form submission, just the client code for creating a multi-file upload UI, for what it is. It's all provided as is.
Hope it may help somebody!
OTHER TIPS
From the documentation included in the download. Also noted on the Upload documentation page (scroll to bottom, under AJAX).
How do I reset the control?
To reset the file selections, just make the following call:
$('input:file').MultiFile('reset')
$("input[type=file]").wrap("<div id='fileWrapper'/>");
$("#fileWrapper").append("<div id='duplicateFile' style='display:none'>"+$("#fileWrapper").html()+"</div>");
$("#fileWrapper").html($("#duplicateFile").html());
This also works..
$('.MultiFile-list').find('a').click();