Hello,
I am using the RadUpload control to add multiple files to the server this was working fine until I added the Progress Area.
Everything works fine the first time around e.g. I can upload multiple files and the progress area displays. However in the same session, when I navigate back to my upload page and try to upload more files, the HttpFileCollection does not detected that I have selected any (the size of the collection is zero). Here is the code in adding files to the server:
Thanks,
David
I am using the RadUpload control to add multiple files to the server this was working fine until I added the Progress Area.
Everything works fine the first time around e.g. I can upload multiple files and the progress area displays. However in the same session, when I navigate back to my upload page and try to upload more files, the HttpFileCollection does not detected that I have selected any (the size of the collection is zero). Here is the code in adding files to the server:
| public bool UploadFilesToServer() |
| { |
| bool validPost = false; |
| if (Page.IsPostBack) |
| { |
| DirectoryInfo parentDir = new DirectoryInfo(Page.Server.MapPath("./SessionFolders/") + UniqueIndentifier + "/"); |
| if (parentDir.Exists) |
| { |
| foreach (FileInfo oldfile in parentDir.GetFiles()) |
| oldfile.Delete(); |
| } |
| HttpFileCollection uploadFilCol = Page.Request.Files; |
| for (int i = 0; i < uploadFilCol.Count; i++) |
| { |
| HttpPostedFile file = uploadFilCol[i]; |
| string fileName = Path.GetFileName(file.FileName); |
| if (fileName != string.Empty) |
| { |
| //Create Folder if neccesary |
| if (!parentDir.Exists) |
| parentDir.Create(); |
| try |
| { |
| file.SaveAs(parentDir.ToString() + fileName); |
| validPost = true; |
| } |
| catch (Exception) { } |
| } |
| } |
| if (!validPost) |
| MessageBox("Please select at least one file."); |
| } |
| return validPost; |
| } |
Thanks,
David