Hi Guys, I have a one FileUpload Control , one Button and TextBox.When clicking on the FileUpload control,we can getting the file URl. After that clicking the Button getting the perticular file Content into TextBox.
Problem is when clicking the Button getting the data into TextBox and same time URL also cleared. How to Stop the clearing the Url in fileUpload control.
protected void btnGet_Click(object sender, EventArgs e)
{
if (FUBrowse.HasFile)
{
string path = FUBrowse.PostedFile.FileName;
this.FUBrowse.SaveAs(path);
this.txtJobDescription.Text = ShowContent(path);
}
}
public string ShowContent(string path)
{
string strInput = "";
string GetStream = "";
if (File.Exists(path))
{
StreamReader sr = new StreamReader(path, UnicodeEncoding.GetEncoding("UTF-8"));
strInput = sr.ReadLine();
while (strInput != null)
{
GetStream += strInput;
strInput = sr.ReadLine();
}
sr.Close();
}
else
{
Response.Write("file does not exist!");
}
return GetStream;
}
Please any one Help me.