Is there a way to set the value of a file input (
<input type="file" />) or is that all blocked for security? I'm trying to use google gears' openFiles to make a simple multi-uploader.
See the answer in this question for details as well as a demo:
How to set file input value programatically (i.e.: when drag-dropping files)?
It is not possible to dynamically change the value of a file field, otherwise you could set it to "c:\yourfile" and steal files very easily.
However there are many solutions to a multi-upload system. I'm guessing that you're wanting to have a multi-select open dialog.
Perhaps have a look at http://www.plupload.com/ - it's a very flexible solution to multiple file uploads, and supports drop zones e.t.c.
referenceToYourInputFile.value = "" ;
I ended up doing something like this for AngularJS in case someone stumbles across this question:
const imageElem = angular.element('#awardImg'); if (imageElem.files) vm.award.imageElem = imageElem; vm.award.image = imageElem.files;
if (vm.award.imageElem) $('#awardImg').replaceWith(vm.award.imageElem); delete vm.award.imageElem;
©2020 All rights reserved.