Multifile Control vs Multiple Single file control?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multifile Control vs Multiple Single file control?

Guest-844

If I need to upload, say 10 files, does it make a difference if I use 10 single inputfile controls vs a multifile control?  

Also for a single file upload control, how I can clear the textbox using a 'clear button', if the user has made an error?

Reply | Threaded
Open this post in threaded view
|

Re: Multifile Control vs Multiple Single file control?

Dean Brettle
Administrator
Using a MultiFile control will typically make for a better user experience and easier development.  Also, with the MultiFile control, the user can delete a file that has been selected by clicking the "X" beside it in the list of files to be uploaded.

To have a "clear" button clear the InputFile control, you'd need to use JavaScript.  My recollection is that if you try to set the "value" property of the element to "", you'll get a security exception under at least some browsers.  I think you need to clone the <input type="file"> element and remove the original, using something like this:

                var inputFile = document.getElementById("InputFileControlID");
                var newInputFile = NeatUploadCloneInputFile(inputFile);
                inputFile.parentNode.replaceChild(newInputFile, inputFile);

--Dean