我要在后台做文件上传,上传的视频文件大约都在300M以上,现请教各位高手指点,最好有详细代码.谢谢!
解决方案 »
- 帮忙解释一下这段代码。
- ListView中执行Edit等命令时导致页面刷新的问题!
- 请教这个问题该怎么解决,谢谢了~
- 怪问题 无法退出编辑状态
- 十万火急!!哈希表移除问题~~~
- 关于VS2005 SP1安装的问题
- dropdownlist 会显示默名奇妙的数据,不是表的数据,数据是System.data.datarowview
- 两个页传值问题
- asp.net C#中如何才能实现录入一个日期如:2005-11-02转化为阴历九月初一
- 非常有意思,你想过吗:aspx页面关闭后, 已做出的操作服务器会一直运行直到结束吗?
- 不好意思没分了,这些天忙着找工作,没来csdn,所以没分了。不过问题还是得问。
- 如何在asp.net中布置表格?
找到windows\system32\inesrv\下的metabase.xml,
打开,找到ASPMaxRequestEntityAllowed 把他修改为需要的值,默认为204800,即200K
然后重启iis admin service服务
把它修改为51200000(50M)
我建议楼主用ftp传吧!
代码也有很多,我们上传大文件都用ftp的,不能用http
ASP.NET默认上传文件大小是4M,通过修改Machine.config文件可以提高上传文件大小...300M建议楼主换另一种上传文件方式,用HTTP可能会超时或客户端显示白页,长时间不响应等症状...
找到里面一个4092的修改
理论上传1G,局域网没什么问题的。
广域网上传300M也没什么问题,只是要等得久点,是很久很久!!想起来就好笑,我前段时间做了系统,里面就有个这种的上传,竟然还有客户哈戳戳的上传600多M的,他还很光荣的告诉我,他等了好久才传上去。
真是服了他了。
不过象这种大文件,建议用另一种方式,不要用http上传,因为不能续传,老火。
要不就做个ActiveX,用ftp的方法上传,既可续传又不怕文件大。限制性小
http://blog.joycode.com/saucer/archive/2004/03/16/16225.aspx
byte[] buffer = new Byte[10000]; // Length of the file:
int length; // Total bytes to read:
long dataToRead; // Identify the file to download including its path.
string filepath = "DownloadFileName"; // Identify the file name.
string filename = System.IO.Path.GetFileName(filepath); try
{
// Open the file.
iStream = new System.IO.FileStream(filepath, System.IO.FileMode.Open,
System.IO.FileAccess.Read,System.IO.FileShare.Read);
// Total bytes to read:
dataToRead = iStream.Length; Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment; filename=" + filename); // Read the bytes.
while (dataToRead > 0)
{
// Verify that the client is connected.
if (Response.IsClientConnected)
{
// Read the data in buffer.
length = iStream.Read(buffer, 0, 10000); // Write the data to the current output stream.
Response.OutputStream.Write(buffer, 0, length); // Flush the data to the HTML output.
Response.Flush(); buffer= new Byte[10000];
dataToRead = dataToRead - length;
}
else
{
//prevent infinite loop if user disconnects
dataToRead = -1;
}
}
}
catch (Exception ex)
{
// Trap the error, if any.
Response.Write("Error : " + ex.Message);
}
finally
{
if (iStream != null)
{
//Close the file.
iStream.Close();
}
}
<httphander maxrequestlength=99999999999></httphander>
net支持最大8m
好像楼上的说ftp比较现实一些