查看文本框中的文件上传内容 [英] view the fileupload content in textbox

查看:70
本文介绍了查看文本框中的文件上传内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是.net的新手
可以使用fileupload控件上载文件,路径也设置为保存文件.现在我想做:我想在同一aspx页面的文本框中查看上载的文件内容.请给我发代码.上传的文件内容可能是word文档/img/pdf,我想在
中查看内容 textbox

hi , i am new to .net
file can be uploaded using fileupload control,path is also set to save the file.now wat i want to do :i want to view the uploaded file contents in textbox in the same aspx page . pls send me the code. uploaded file content may be word document /img/pdf, i want to view the contents in
textbox

推荐答案

尝试阅读本文文件上传方式为ASP.NET [^ ]

对于将内容分配给文本框,您可以在下面使用以下代码:
Try to read this article File Upload with ASP.NET[^]

For the assignment of content to textbox you can use this code below:
TextBox txtData; // assume this is your text box control
FileUpload fileUpload; //your fileupload control
StreamReader r = new StreamReader(fileUpload.FileContent);
txtData.Text = r.ReadToEnd();


这篇关于查看文本框中的文件上传内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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