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
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