HttpFileCollection fc = Request.Files;
HttpPostedFile pf = fc[0];
if (pf.ContentLength > 0)
{
string split = TextBox1.Text;
StringBuilder sb = new StringBuilder();
StreamReader sr = new StreamReader(pf.InputStream, Encoding.Default);
while (!sr.EndOfStream)
{
string[] sa = sr.ReadLine().Split(split.ToCharArray());
foreach (string s in sa)
{
sb.Append(s);
sb.Append(";");
}
sb.Append("<br>");
}
Response.Write(sb.ToString());
}
asp.net 读取txt文件的方法
最新推荐文章于 2024-02-22 09:45:07 发布