朋友, 单击浏览按钮时,我有一个浏览按钮,它正在搜索 计算机中的文件,如果我按OK,则必须读取它.但无法读取.我应该在控制器和视图中编写什么代码.我用过 fileReader和StreamReader方法.我应该怎么做 朋友,我正在使用asp mvc 3 Web应用程序,请告诉我有关此信息 迫切的 请提供其他替代方法来纠正我的问题 谢谢大家
hi friends, I have an browse button when clicking on that browse button it is searching for files in the computer and if i press ok then it has to be read.but the reading is not possible.What code should i suppose to write in the controller and view.I have used fileReader and StreamReader methods.what should i suppose to do Friends i am using asp mvc 3 web application please tell me regarding this its urgent please provide any alternative ways to rectify my problem Thank you all
推荐答案导入IO名称空间 import IO namespace using System.IO;
使用以下代码读取文件的所有内容
use below code read all content of a file
StreamReader objReader=new StreamReader(fullFilePath); string fileContent=objReader.ReadToEnd(); objReader.Close();祝您好运Priya!
Best of luck Priya!
嗨Priya0143, 请参考此链接如何:从文本文件读取(C#编程指南) [ ^ ] Hi Priya0143, Please refer this link How to: Read From a Text File (C# Programming Guide)[^]
您好, 试试这个 字符串s = System.IO.File.ReadAllText(path); 请参阅此链接 stackoverflow/questions/8939640/how-to-read-a-doc-and-docx-file-in-asp-net-mvc3-and-display-in-textbox [ ^ ] 希望对您有帮助 祝你好运 快乐编码:) Hi, try this string s = System.IO.File.ReadAllText( path ); refer this link stackoverflow/questions/8939640/how-to-read-a-doc-and-docx-file-in-asp-net-mvc3-and-display-in-textbox[^] hope it help u best Luck Happy Coding:)
更多推荐
如何使用C#从计算机读取文件
发布评论