同じページで 2 つの Ajaxfileupload コントロールを使用しようとしていますが、どちらも同じ uploadcomplete 関数に入り、理由がわかりません.. (それらは「AjaxFileUpload1_UploadComplete」関数に入ります)
ここに私のaspx部分があります:
<asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" OnUploadComplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="10" AllowedFileTypes="jpg,jpeg"/>
<asp:AjaxFileUpload ID="AjaxFileUpload2" runat="server" OnUploadComplete="AjaxFileUpload1_prof_pic" ThrobberID="myThrobber" MaximumNumberOfFiles="1" AllowedFileTypes="jpg,jpeg"/>
ここに私のコードビハインドがあります:
protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
Directory.CreateDirectory(Server.MapPath("~/Member_Data/" + id + "/images/"));
string filePath = "~/Member_Data/" + id + "/images/";
string path = filePath + e.FileName;
AjaxFileUpload1.SaveAs(Server.MapPath(filePath) + e.FileName);
db1.insert_pic_slide(id, path);
string qstring = "?id=" + id;
//Response.Redirect("profile_layout.aspx" + qstring);
}
protected void AjaxFileUpload1_prof_pic(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
{
Directory.CreateDirectory(Server.MapPath("~/Member_Data/" + id + "/images/"));
string filePath = "~/Member_Data/" + id + "/images/";
string path = filePath + e.FileName;
AjaxFileUpload2.SaveAs(Server.MapPath(filePath) + e.FileName);
db1.insert_pic(id, path);
string qstring = "?id=" + id;
Response.Redirect("profile_layout.aspx" + qstring);
}