Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
9
Reply
FileUpload control within UpdatePanel in asp.net
Rahul Prajapat
Jun 17 2015 10:30 PM
763
Reply
My source file is:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Upload" onclick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
and code behind code is:
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
string Prefix = DateTime.Now.ToString("ddMMyyhhmmsstt");
string Doc_Name = (Path.GetFileName(FileUpload1.PostedFile.FileName)).Split('.')[0].ToString();
string str = FileUpload1.FileName;
string targetPath = Server.MapPath("~\\images\\Docs\\") + Prefix + FileUpload1.FileName;
FileUpload1.SaveAs(targetPath);
}
}
My problem is that FileUpload1.HasFile return false, why ?
And how can fix it and save the file in folder.
Please help me...
Thanks in advance.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
9
)
Next Recommended Forum
Los Cafeteros will hope to turn the tables at the Estadio Mo
datavisualization - Audiometric chart