111,098
社区成员




HttpFileCollection files = Request.Files;
for (int j = 0; j < files.Count;j++ )
{
if (files[j].ContentLength<=0)
{
continue;
}
HttpPostedFile f = files[j];
mname = Path.GetFileName(f.FileName);
long msize = f.ContentLength;
Stream s = f.InputStream; //1、Stream 类不是抽象类么?为什么可以实例化
byte [] buf=new btye[msize]; //2、如果这个文件很大。怎么办,怎么转换成流
s.Read(buf ,0 msize);
string path=Server.MapPath("FileDir/"+mname);
FileStream fs=new FileStream(path ,FileModel.OpenOrCreate ,FileAccess.Write);
fs.Write( buf ,0 ,Convert.ToInt32(msize) ); //3、长度的参数为int,如果是大文件怎么处理
.....
}
//4、其外,能用buf来存储这个文件的流,是不是说明,这个文件的流,实际上已经在服务器的内存里面了?
// 额。那岂不是脱裤子放屁。。。。 ,
// 求个思路,,能做上传文件的进度条的。。求高手给个思路。