用NeatUpload上传大文件,在本机上测试可以上传300M的文件,上G的文件没有测试。但我把网站发布到web服务器上后,在本机IE浏览器访问网站上传文件,小文件可以上传,但50M的文件上传就不成功了,很困惑。请高手指点!
Web.Config中配置
........
<configSections>
<sectionGroup name="system.web">
<section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler,Brettle.Web.NeatUpload" allowLocation="true" />
</sectionGroup>
</configSections>
..........
<httpModules>
<!--上传大文件-->
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule,Brettle.Web.NeatUpload"/>
</httpModules>
<!--useHttpModule="true" 设为true时才能看到上传状态,默认是False-->
<neatUpload useHttpModule="true" maxNormalRequestLength="1048576" maxRequestLength="1048576" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>
<httpRuntime maxRequestLength="1048576" executionTimeout="3600"/>
.............
Web.Config中配置
........
<configSections>
<sectionGroup name="system.web">
<section name="neatUpload" type="Brettle.Web.NeatUpload.ConfigSectionHandler,Brettle.Web.NeatUpload" allowLocation="true" />
</sectionGroup>
</configSections>
..........
<httpModules>
<!--上传大文件-->
<add name="UploadHttpModule" type="Brettle.Web.NeatUpload.UploadHttpModule,Brettle.Web.NeatUpload"/>
</httpModules>
<!--useHttpModule="true" 设为true时才能看到上传状态,默认是False-->
<neatUpload useHttpModule="true" maxNormalRequestLength="1048576" maxRequestLength="1048576" defaultProvider="FilesystemUploadStorageProvider">
<providers>
<add name="FilesystemUploadStorageProvider" type="Brettle.Web.NeatUpload.FilesystemUploadStorageProvider, Brettle.Web.NeatUpload"/>
</providers>
</neatUpload>
<httpRuntime maxRequestLength="1048576" executionTimeout="3600"/>
.............
解决方案 »
- 请大虾们帮我写个函数,用SQL和C#两种方式
- sql2005联机帮助是通过webservice获取的吗?发现其响应速度超快,比在IE下打开相应网页快多了。请详细解析一下。
- 能否用ASP.NET来与客户端的设备进行通讯
- 动态加载TextBox时取值的问题??急急急急?????????
- 请问在2005里使用强类型dataset的问题
- 能够找到web地址,但打不开网页,请教是为何啊?
- 分享一个方法:在TextBox中光标位置处插入内容(WEB)
- 匹配任何6位以上字符的正则表达式
- 关于跳转404页面的问题
- 关于邮件发送时用streamreader读取文件作为body时编码问题
- 如何实现类似注册时,先检查用户名是否重复.
- VS2005与VS2008有什么区别?
3600秒? session都早就失效了.
主要是下面两项maxAllowedContentLengthMaxRequestEntityAllowed
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.IO;
using System.Collections;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnupfile_Click(object sender, EventArgs e)
{
string filename = fu.Value;
Response.Write("<script type=\"text/javascript\">var sinfo=document.getElementById(\"sinfo\"); ");
FileStream fsInput = new FileStream(filename, FileMode.Open, FileAccess.Read);
StreamReader srInput = new StreamReader(fsInput);
ArrayList arraylist = new ArrayList();
string srline;
while ((srline = srInput.ReadLine()) != null)
{
arraylist.Add(srline);
}
srInput.Close(); //关闭文件,释放资源
fsInput.Close(); //文件写
string upfilepath = Server.MapPath("photo/") + Guid.NewGuid() + System.IO.Path.GetExtension(filename);
FileStream fsOutput = new FileStream(upfilepath, FileMode.Create, FileAccess.Write);
StreamWriter swOutput = new StreamWriter(fsOutput);
int fisize = fu.MaxLength;
for (int i = 0; i < arraylist.Count; i++)
{
Response.Write(" var val; val=\"文件大小:"+fisize+"K;\"");
Response.Write(" val +=\"已上传: " + i * 1024 + "K;\"");
Response.Write("sinfo.innerHTML=val;");
swOutput.WriteLine(arraylist[i]);
}
swOutput.Close();
fsOutput.Close(); }
}
如果有时间的话,可以加QQ教教我吗 190131132