views:

22

answers:

2

I want to get all the file upload controls on my page, Im adding multiple file upload control so i dont have any idea how many they can be but i have to get all of them in jquery. Im using asp.net mvc and jquery

+4  A: 

Use:

$(':file').each(function(){
  // your code to handle input type files.
});

Or:

$('input[type="file"]').each(function(){
  // your code to handle input type files.
});

More Info:

http://api.jquery.com/file-selector/

Sarfraz
A: 

When do you want to get the input field? after clicking a button? or changing the input field? if you add dynamic the input field than you can maybe better use the live option.

$('input[type="file"]').live("blur",function(){
        $('input[type="file"]').each(function(){
              // you can put your code here
            });
    });

see: http://api.jquery.com/live/

above code is from jQuery 1.4

Better give more information next time

michel