0

I am using telerik asyncupload control to upload files but the control is just loading one file and after that it is giving io exception saying parameter not found.

<telerik:RadAsyncUpload ID="AsyncUpload1" runat="server" ChunkSize="0"       TemporaryFolder="~/logos">
                                </telerik:RadAsyncUpload>
                                    <asp:Button ID="btnUpload" runat="server"   Text="Upload" onClick="btnUpload_Click" CssClass="about-btn" />

and in code

foreach (UploadedFile f in AsyncUpload1.UploadedFiles)
            {
                string temp;

                temp = "~/logos/" + f.FileName.ToString(); 
                AsyncUpload1.TargetFolder = temp;
                f.SaveAs(Server.MapPath(temp));
}
Hasan Zubairi
  • 1,037
  • 4
  • 23
  • 57

1 Answers1

0

Try as following:

foreach (UploadedFile f in AsyncUpload1.UploadedFiles)
  {
   string temp;
   temp = "~/logos/" + f.FileName.ToString(); 
   AsyncUpload1.TargetFolder = temp;
   f.SaveAs(Server.MapPath(temp), true); //modified line
  }
FeliceM
  • 4,163
  • 9
  • 48
  • 75
  • No its not working. I put a break point at foreach loop but second time it never reached there and just pressing the upload button gives the error. – Hasan Zubairi Aug 12 '14 at 06:03
  • Since you already set the folder in code behind, try to remove the temporary folder in the markup TemporaryFolder="~/logos">. Is there anything else in the button? Is the first file saved properly? – FeliceM Aug 12 '14 at 06:05
  • Are you sure the second file gets a name? I mean, does the loop receive the second file name f.FileName.ToString(); ? – FeliceM Aug 12 '14 at 06:10
  • Removing temporary file location also did not help. f.filename is not reached second time as it is breaking at buttons click event. – Hasan Zubairi Aug 12 '14 at 06:22