Click here to Skip to main content
16,004,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using jquery.MultiFile.js to upload multiple files using fileupload control in an update panel and using trigger to postback on button click but on first click it uploads only one file and starts uploading multiple files after that below is my code

C#
HttpFileCollection fileCollection = Request.Files;
           for (int i = 0; i < fileCollection.Count; i++)
           {
               HttpPostedFile uploadfile = fileCollection[i];
               string file = Path.GetFileName(uploadfile.FileName);
               string extension = Path.GetExtension(file);
               if (uploadfile.ContentLength > 0)
               {
                   string no = Guid.NewGuid().ToString().Substring(0, 4);
                   string path = @"../Gallery/";
                   string serverpath = Server.MapPath(path);
                   string fullpath = serverpath + no + file;
                   uploadfile.SaveAs(fullpath);
                   valid += file + " saved successfully\\n";
               }


Thanks
Posted
Updated 13-Apr-13 3:02am
v2

1 solution

Provide the UpdatePanel for file Upload control and make a PostBackTrigger for Import button.
 
Share this answer
 
Comments
lucky050 15-Apr-13 9:11am    
I am already using a postback trigger for import button and its working but it uploads only one file on page load after that it starts working fine

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