Is there an upload limit when using Web Client in C#?

不打扰是莪最后的温柔 提交于 2019-12-18 08:58:09

问题


Using UploadFile("upload.php", "POST", filePath) with WebClient anything over 4mb will not upload. The limit in PHP is set at 48mb. Is there I need to set in C# ?


回答1:


There is a default maxRequestLength set at 4MB in ASP.NET, you can change it in the web.config.

<configuration>
    <system.web>
        <!-- This will handle requests up to 1024MB (1GB) -->
        <httpRuntime maxRequestLength="1048576" timeout="3600" />
    </system.web>
</configuration>

The length is specified in KB in the config file. If you are using IIS there is an additional limit set at 4MB by IIS.




回答2:


I have solved the problem. By changing the following in the php.ini

post_max_size = 40M

I had already changed the upload_max_filesize but was not aware of this other param which needed changing.



来源:https://stackoverflow.com/questions/26941906/is-there-an-upload-limit-when-using-web-client-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!