Telerik RadAsyncUpload只能工作一次

时间:2014-08-12 04:02:40

标签: asp.net file-upload telerik asyncfileupload

我正在使用telerik asyncupload控件来上传文件,但控件只是加载了一个文件,之后它给出了io异常,说明找不到参数。

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

并在代码中

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

                temp = "~/logos/" + f.FileName.ToString(); 
                AsyncUpload1.TargetFolder = temp;
                f.SaveAs(Server.MapPath(temp));
}

1 个答案:

答案 0 :(得分:0)

请尝试以下操作:

foreach (UploadedFile f in AsyncUpload1.UploadedFiles)
  {
   string temp;
   temp = "~/logos/" + f.FileName.ToString(); 
   AsyncUpload1.TargetFolder = temp;
   f.SaveAs(Server.MapPath(temp), true); //modified line
  }