View Full Version : Retry a file upload?

20 Jun 2014, 12:20 AM

In my program, using Ext 4.2.0 and PHP, I have a form where users can upload a file. This is using the Ext.form.field.File component. When the file is submitted there is the possibility that an exception may be raised server-side. This could be, for instance, because the program wants the user to re-submit their password to ensure that they are who they say they are.

When this happens, I want to be able to put up a messagebox asking for the user's password and then retry uploading the file. This works fine with normal AJAX requests since I just resend the request. However after the unsuccessful file upload the file field becomes blank and I can't re-submit the form without the user re-selecting which files they want. Is there any way around this?


20 Jun 2014, 5:39 AM
If anyone's interested, I managed to achieve it by taking a copy of the filefield's fileInputEl.dom.files attribute just before submitting the form for the first time. Then when it failed, I used that copy to fill the filefield again and re-submitted it.