//判断上传的文件是否为空
HttpPostedFile postFile = Request.Files["upfile"];
if (postFile == null || postFile.ContentLength < 0)
{

    //提示为空或者其他操作 

//如果是文本文件,读取其内容
Stream s = StreamCopyTo(postFile.InputStream);
StreamReader sr = new StreamReader(s, System.Text.Encoding.Default);
strCode = sr.ReadToEnd(); //strCode就是文本文件中的内容
s.Close();

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-29
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-01-13
  • 2022-12-23
  • 2021-06-17
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案