An application uses the latest version of jQuery File Uploader and sometimes 499 errors (client closed request) are observed during uploads. My assumption is that this error appears if users are using unstable WLAN connections. Does anybody have experience with this issue and is there a fix for this? I’d like to extend the jQuery File Uploader in order to detect the 499 errors and re-upload the same image again until it goes through. Thanks!
2
Answers
Here is my solution, which works very well:
In the
add()
config i added a retrial:With this solution, if the upload fails for any reasons, it just tries 2 times again to re-upload the same image.
I believe there are callback functions available with this that you could use to call an API or capture failures and handle them appropriately. For example, you could display a message to the user, such as "Sorry, there was an error. Please try again," allowing them to re-attempt the upload. Additionally, you could use its resumable support so that it can pick up from the data already uploaded rather than starting from scratch, thereby hopefully mitigating the likelihood of the same error occurring when there is less data to upload.
see: https://github.com/blueimp/jQuery-File-Upload/wiki/Options
and see: https://github.com/blueimp/jQuery-File-Upload/wiki/Chunked-file-uploads
I hope this helps