devan
devan

Reputation: 1653

'The connection was reset' browser error when trying to upload heavy image

I am trying to upload a picture from ASP:fileupload control. When user select JPG file from local disk and click on Button ,it will upload to server.

This is working fine and upload picture as expect.

However when user give heavy image like 8MB the browser gives an error.

The connection was reset. The connection to the server was reset while the page was loading.

I debug the code and try to figure out from where is occur. However I couldn't point the issue. It will not trigger Page load event or button click event either.

Please help me to avoid this error or validate the file size before file upload the image.

Upvotes: 1

Views: 2414

Answers (1)

Peter Kiss
Peter Kiss

Reputation: 9329

Try set theese in web.config (if there is a nested one beside the file upload then there two):

<system.web>
      <httpRuntime maxRequestLength="16384" executionTimeout="120" />
    </system.web>

The settings above means: the maximum request length with all data (Post, files, etc) is 16 MB and the request will timeout after 120 seconds. Ofcourse you can adjust these values.

Upvotes: 1

Related Questions