问题是:
在默认页面中我有两个AjaxFileUpload控件,我按照规则完成了代码,当我在上传按钮中单击上传时,逐个图像将只存储在一个文件夹中 (即同一个第一个文件夹)。
页面代码如下所示
<form id="form1" runat="server">
<asp:ScriptManager ID="sm1" runat="server">
</asp:ScriptManager>
<div>
<asp:Image ID="Image1" runat="server" />
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="FileUploadCompleteEvent1"
ThrobberID="Image1" Width="400" />
</div>
<div>
<asp:Image ID="Image2" runat="server" />
<ajaxToolkit:AjaxFileUpload ID="AjaxFileUpload2" runat="server" ThrobberID="Image2"
OnUploadComplete="FileUploadCompleteEvent2" Width="400" />
</div>
</form>
和Default.aspx.cs是
protected void FileUploadCompleteEvent1(object o,AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string file = Server.MapPath("~/i/") + e.FileName;
AjaxFileUpload1.SaveAs(file);
}
protected void FileUploadCompleteEvent2(object o, AjaxControlToolkit.AjaxFileUploadEventArgs eve)
{
string file = Server.MapPath("~/i1/") + eve.FileName;
AjaxFileUpload2.SaveAs(file);
}
我想将这些文件存储在单独的文件夹(i和i1)中,我附上了我正在使用的代码。