ASP.NET上传大文件
文件一般在300M~600M(电影),网上也搜了一下,至今没找到好的方法.
至于用.Net中的FileUpload控件,修改Web.config这个方法不是很好,全部读入到内存简直就是死机了,
大部分网页都提到思归的那篇文章
http://blog.joycode.com/saucer/archive/2004/03/16/16225.aspx
看了之后,如果用SlickUpload的话,还收费,99美圆,感觉很贵(如果谁买过可以免费给我还行,破截的在参考范围之类)
还有就是这断代码,最关键用 ".... "替代了,汗~
IServiceProvider provider = (IServiceProvider) HttpContext.Current;
HttpWorkerRequest wr = (HttpWorkerRequest) provider.GetService(typeof(HttpWorkerRequest));
byte[] bs = wr.GetPreloadedEntityBody();
....
if (!wr.IsEntireEntityBodyIsPreloaded())
{
int n = 1024;
byte[] bs2 = new byte[n];
while (wr.ReadEntityBody(bs2,n) > 0)
{
.....
}
}
谁能提供一个NB的解决方法,最好以前解决过类似问题.
还有就是到处是这个代码
HttpApplication application1 = sender as HttpApplication;
HttpWorkerRequest request1 = (HttpWorkerRequest) ((IServiceProvider) HttpContext.Current).GetService(typeof(HttpWorkerRequest));
try
{
if (application1.Context.Request.ContentType.IndexOf( "multipart/form-data ") <= -1)
{
return;
}
//Check The HasEntityBody
if (!request1.HasEntityBody())
{
return;
}
int num1 = 0;
TimeSpan span1 = DateTime.Now.Subtract(this.beginTime);
string text1 = application1.Context.Request.ContentType.ToLower();
byte[] buffer1 = Encoding.ASCII.GetBytes(( "\r\n-- " + text1.Substring(text1.IndexOf( "boundary= ") + 9)).ToCharArray());
int num2 = Convert.ToInt32(request1.GetKnownRequestHeader(11));
Progress progress1 = new Progress();
application1.Context.Items.Add( "FileList ", new Hashtable());
byte[] buffer2 = request1.GetPreloadedEntityBody();
num1 += buffer2.Length;
string text2 = this.AnalysePreloadedEntityBody(buffer2, "UploadGUID ");
if (text2 != string.Empty)
{
application1.Context.Items.Add( "LionSky_UpLoadModule_UploadGUID ", text2);
}
bool flag1 = true;