文件上传问题 [英] file upload issue

查看:147
本文介绍了文件上传问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要通过浏览器客户端(最终用户)上传大文件(例如,类似YouTube的情况下其上传大的视频文件),文件大小应不大于500M字节。

我使用ASP.Net + C#+ VSTS + IIS 7.0作为我的开发平台。关于如何处理大文件上传问题的任何想法或好的做法?任何参考样本或文档AP preciated。


解决方案

 <&的System.Web GT;
        <的httpRuntime executionTimeout =300的maxRequestLength =512000/>
    < /system.web>

这不会在IIS7工作!的httpRuntime是IIS6和波纹管。正确的方法,让IIS7中的大文件的上传是:

1)将下列行添加到Web.config文件:

[Web.config文件对于IIS7 maxAllowedContentLength属性

 < system.webServer>
   <安全>
      <&的requestFiltering GT;
          < requestLimits maxAllowedContentLength =10.24亿/>
      < /&的requestFiltering GT;
   < /安全>
< /system.webServer>

2),然后打开文件C:\\ WINDOWS \\ SYSTEM32 \\ INETSRV \\设置\\的applicationHost.config并找到行:

 <节名称=的requestFilteringoverrideModeDefault =允许/>

overrideModeDefault应该允许。

I will need client (end user) through browser to upload big files (e.g. similar to Youtube's scenario which uploads big video files), the file size should be no larger than 500M bytes.

I am using ASP.Net + C# + VSTS + IIS 7.0 as my development platform. Any ideas or good practices about how to handle big file upload issue? Any reference samples or documents are appreciated.

解决方案

    <system.web>
        <httpRuntime executionTimeout="300" maxRequestLength="512000" />
    </system.web>

This will not work in IIS7! httpRuntime is for IIS6 and bellow. The correct way to allow large file uploads in IIS7 is:

1) Add the following lines to the web.config file:

[Web.config] maxAllowedContentLength attribute for IIS7

<system.webServer>
   <security >
      <requestFiltering>
          <requestLimits maxAllowedContentLength="1024000000" />
      </requestFiltering>
   </security>
</system.webServer>

2)Then open the file C:\Windows\System32\inetsrv\config\applicationHost.config and find the line:

<section name="requestFiltering" overrideModeDefault="Allow" />

overrideModeDefault should be Allow.

这篇关于文件上传问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆