Click here to Skip to main content
15,889,454 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
how to copy file uploads path to Textbox


Upon file upload browse button click i need to copy the same text to another text box
Posted

1 solution

You can't get the full file path of the client side original file path. but you can get the file name as below
C#
fileNameTxt.Text =fileupload.FileName;

if you need to display the content of the file in a text box;
C#
protected void  btnUpoad_ServerClick(object sender, EventArgs e)
{
    if(fileupload1.HasFile)
    {
        fileNameTxt.Text =fileupload.FileName.ToString();
        fuUpload.SaveAs(Server.MapPath("images")+"\\"+fileupload1.FileName);
        fileContent.Text =File.ReadAllText(Server.MapPath("images")+"\\"+fileupload1.FileName);
    }
}
 
Share this answer
 
v2
Comments
Member 10843538 26-May-14 2:54am    
Thanks for help, but can it be done in javascript

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900