如何将文件上传路径复制到Textbox [英] how to copy file uploads path to Textbox

查看:120
本文介绍了如何将文件上传路径复制到Textbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何将文件上传路径复制到文本框





文件上传时浏览按钮单击我需要将相同的文本复制到另一个文本框

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

推荐答案

您无法获取客户端原始文件路径的完整文件路径。但你可以得到如下文件名

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



如果你需要在文本框中显示文件的内容;


if you need to display the content of the file in a text box;

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);
    }
}


这篇关于如何将文件上传路径复制到Textbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆