Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
2.33/5 (3 votes)
See more:
hi sir i am trying to upload multiple files in asp.net. I google about this but i find only flash controls or client have to select each file(one file at once),

so, is there anything else I can do about this or any control which can select multiple files, or any hint/advise
plzz help....
thank u
Posted
Comments
reid0588 26-May-11 9:10am    
http://lmgtfy.com/?q=upload+multiple+file+using+asp.net
reid0588 26-May-11 9:12am    
What files are you wanting to upload? and where are you wanting to upload them to? e.g excel file to an sql server?
[no name] 26-May-11 9:57am    
Irrelevant
[no name] 26-May-11 11:11am    
your comment has got nothing to do with this question.
dkgawriya21 30-May-11 1:28am    
I want to upload videos and images to web and their records in sql database

Take a look at this CodeProject article. Multiple File Upload With Progress Bar Using Flash and ASP.NET[^]

Good luck.
 
Share this answer
 
Comments
Ashishmau 27-May-11 1:00am    
Nice Link
Wonde Tadesse 27-May-11 7:40am    
Thanks
You can place multiple Upload controls on a page.

There are other examples, not using Flash or Silverlight, you just need to look a little harder.
 
Share this answer
 
Comments
dkgawriya21 26-May-11 8:53am    
sir can i get link for googling...........
In ASP.NET you can you this piece of code. This will solve your issue and you can upload multiple files

C#
 
protected void btnUpload_Click(object sender, EventArgs e)
 
{
 
        try
 
        {
 
            // Get the HttpFileCollection
 
            HttpFileCollection hfc = Request.Files;
 
            for (int i = 0; i < hfc.Count; i++)
 
            {
 
                HttpPostedFile hpf = hfc[i];               

                if (hpf.ContentLength > 0)
 
                {
 
                    hpf.SaveAs(Server.MapPath("MyFiles") + "\\" +
 
                      Path.GetFileName(hpf.FileName));                       

                }               

            }    

        }
 
        catch (Exception ex)
 
        {
 
            // Handle your exception here
 
        }
 
 
 
}
 
Share this answer
 
Comments
dkgawriya21 26-May-11 9:11am    
i have used this code but if i have 500 files then i have to add 500 upload controls to use such a method

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900