我正在尝试实现一个简单的 ajaxtoolkit 文件上传控件,每次单击“上传”时,我得到的都是一个错误。我尝试在“AjaxFileUpload1_UploadComplete”函数中放置断点,但它甚至不会被触发..(可能是因为上传还没有完成?)我应该怎么做才能让它工作?
这是错误:
这是我的aspx:
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server"
onuploadcomplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="10" AllowedFileTypes="jpg,jpeg"/>
</div>
</form>
这是背后的功能:
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
string id = "038191904";
Directory.CreateDirectory(Server.MapPath("~/App_Data/" + id + "/scanned_docs/"));
string filePath = "~/Member_Data/" + id + "/images/";
string path = filePath + e.FileName;
AjaxFileUpload1.SaveAs(Server.MapPath(filePath) + e.FileName);
//db1.insert_pic_slide(id, path);
}