Forum Moderators: phranque

Message Too Old, No Replies

Best way to deal with 413 error

413 (Request Entity Too Large)

         

NickMNS

6:20 pm on May 31, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I've got a form that includes the submission of many photos, anywhere from none to 16 images. The simplest solution would be to adjust the settings of the server (nginx) to allow greater max upload size. But I'm thinking this may not be the best solution for security reasons. The other solution would be to break up the request and send fetch request for each image in the form. I'll likely need to do both, the default value for client_max_body_size is 1m, which isn't likely to be enough even for one image.

Any ideas on how to deal with this?

phranque

9:18 pm on May 31, 2021 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



on some servers it may be possible to increase max body size to 4G.

it would probably work best if you used a javascript app to upload the file in "slices".
here are some places to start:
FileReader [developer.mozilla.org]
Blob.slice [developer.mozilla.org]

lammert

10:06 pm on May 31, 2021 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Using a JavaScript solution will also give you the opportunity to add a progress indicator.

phranque

2:53 am on Jun 1, 2021 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



progress indicator

speaking of which, i had never heard of a "throbber" before looking at some JS upload examples today...