I'm trying to implement a simple ajaxtoolkit fileupload control and every time I click "Upload" all I get is an error. I tried placing breakpoint in the "AjaxFileUpload1_UploadComplete" function but it won't even get fired.. (maybe because upload isn't complete yet?) what should I do to make it work?
here is the error:
here is my 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>
and here is the funcion behind:
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);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…