toshi近亲,赵燕国彰的老婆,亡国的阿基德
private list<string> savecontentupload(fileupload file)
{
list<string> list_content = new list<string>();//定义集合,存储文件内容
double count = 0;
int pagesize = 1000;//设置每次读取的长度为1000
string context = "";//上传文件内容
using (stream reader = file.postedfile.inputstream)
{
int filelen = file.postedfile.contentlength;//获取上传文件的大小
byte[] buff = new byte[filelen];
reader.read(buff, 0, filelen);
reader.position = 0;
system.io.streamreader sr = new system.io.streamreader(reader, system.text.encoding.default);
context = sr.readtoend();
count = context.length;
int num = convert.toint32(math.ceiling(count / pagesize));
for (int i = 0; i < num; i++)
{
int sum = pagesize;
if (count - (i * pagesize) < pagesize)
{
sum = convert.toint32(count - (i * pagesize));
}
string text = context.substring(i * pagesize, sum);
list_content.add(text);
}
}
return list_content;
}
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
Blazor server side 自家的一些开源的, 实用型项目的进度之 CEF客户端
.NET IoC模式依赖反转(DIP)、控制反转(Ioc)、依赖注入(DI)
vue+.netcore可支持业务代码扩展的开发框架 VOL.Vue 2.0版本发布
网友评论