0

I am trying to create a form for uploading multiple files with an angular app for the UI and a web API action to receive the data from the form. The form and API action works if the total size for all the form files is less than 20mb or so, but above this the browser displays an error page with the text "ERR_CONNECTION_RESET". I have generated a clean angular 5.2.11 project using angular cli 1.6.7 and inserted this code directly into app.component.html for simplicity:

<form name="form1" method="post" enctype="multipart/form-data" action="https://localhost:5001/api/v1/foo">
    <div>
        <label for="files">Upload file</label>
        <input name="files" type="file" multiple />
    </div>
    <div>
        <input type="submit" value="Submit" />
    </div>
</form>

I even tried creating a flat HTML file with the above snippet and the same behavior still occurs; under 20mb everything works and the web API action is executed, but anything above 20mb displays ERR_CONNECTION_RESET in the browser and the API action is not hit. This behavior applies to both Chrome 71.0.3578.98 and IE 11

This obviously has to do with the total size of the uploaded files but without a web.config or appsettings.json I don't know if and where I can change this. Where is the limit set and is it possible to change it? Is it only possible to validate the total file size on the client side since the error occurs before the API action is hit?

Stig Perez
  • 3,595
  • 4
  • 23
  • 36
  • it might show an ERR_CONNECTION_RESET in the browser, but it does continue in the backend. To verify this, try uploading a file of 100MB, when it shows error in browser leave it idle for a few moments and wait to see if it hits the API action or not. If it does, then you may need a method to keep the session alive on the client side. If it doesn't, then the problem may be something bigger than this. You can also verify this from the networks tab in dev console. – M M Jan 15 '19 at 11:03
  • Hi @MM I tried with a 40mb file and let it simmer for a good 45 minutes after I received the ERROR_CONNECTION_RESET but unfortunately it does not seem like the action method is hit. The network tab also confirms this - there are no pending requests at all – Stig Perez Jan 15 '19 at 14:45
  • strange! Suggest you to follow [this](https://stackoverflow.com/questions/47936183/angular-file-upload) link and give it a try. – M M Jan 17 '19 at 05:34

0 Answers0