Reputation: 59
where error? if i dont use ajax, then form is valid, and file is uploading, but now page reload and...file not load in path, why?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<p>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" onclick="Upload" Text="downdoad..."
BackColor="#0099CC" Font-Size="Small" />
</p>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
downdoad...
</ProgressTemplate>
</asp:UpdateProgress>
Upvotes: 1
Views: 188
Reputation: 1
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(Server.MapPath("~/Uploads" + FileUpload1.FileName));
Label1.Text = "Saved Successfully";
}
else
{
Label1.Text = "File Not found";
}
}
In the above code file does not Add in Upload Folder
Upvotes: -1
Reputation: 3919
Fileupload doesn't work in an updatepanel, you have a workaround on this url http://www.codeproject.com/useritems/simpleajaxupload.asp
Upvotes: 3