My source file is:
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);
}
}
{
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.

Jaipal ReddyPosted Jun 20, 2015, 2:46 AM
Nilesh JadavPosted Jun 20, 2015, 2:43 AM
Still you have problem then refer this link :
http://www.aspsnippets.com/Articles/Using-FileUpload-Control-inside-ASP.Net-AJAX-UpdatePanel-Control.aspx
Thank you !
Rahul PrajapatPosted Jun 20, 2015, 2:25 AM
Jaipal ReddyPosted Jun 20, 2015, 2:08 AM
Jaipal ReddyPosted Jun 20, 2015, 2:07 AM
Munesh SharmaPosted Jun 18, 2015, 4:48 AM
Khan Abrar AhmedPosted Jun 18, 2015, 3:57 AM
{
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);
}
}
Nilesh JadavPosted Jun 18, 2015, 3:11 AM
Yes it will return false, this is because of - "Postback" -
you have to use - "Triggers " like this :
Hope it works , Mark accepted if it works
Thank you
Santhakumar MunuswamyPosted Jun 17, 2015, 11:36 PM