问题
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