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

前端 未结 2 587
北荒
北荒 2020-12-21 09: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# ?

相关标签:
2条回答
  • 2020-12-21 09:37

    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.

    0 讨论(0)
  • 2020-12-21 09:48

    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.

    0 讨论(0)
提交回复
热议问题