1

All, I'm trying to have a button that when I click it opens up and allows the user to select multilpe files to be uploaded to my site. How can I do this?

After the user selects the files how would I use this bit of code to show the file names that the user selected:

var files = $('input[type="file"]')[0].files;
for (var i = 0; i < files.length; i++)
{
    alert(files[i].name);
}

Any guidance you can provide on this would be greatly appreciated! Thanks in advance!

user1048676
  • 9,756
  • 26
  • 83
  • 120

1 Answers1

1

I believe this is what you want:

Javascript get number of files and their filenames from file input element with multiple attribute?

You may also want to check this out.

http://davidwalsh.name/multiple-file-upload

Looks like some of the new browsers support what you want to do. Otherwise, you can use a plugin like Uploadify (flash based).

http://blog.bobcravens.com/2011/03/upload-multiple-files-with-progress-using-uploadify/

Hope this helps.

Bob

Community
  • 1
  • 1
rcravens
  • 8,320
  • 2
  • 33
  • 26