I have a modal window that presents a form to users. The form includes one or more file uploads as well. Therefore I cannot submit the form with ajax.
At the moment I'm doing a standard submit with a submit button. When the form is submitted (which takes a few seconds in general), a PDF is generated and sent back for download (i.e. the Content-Disposition: attachment header), to force the download. Once the upload of the form data has completed, I need to close the modal window. If I call the close method straight way the submission never completes and the file download is never triggered (I think this is because the modal window is removed from the DOM). I can set a timeout, but there could be n number of images, so the time it takes to upload is unpredictable (and relative to the number of uploads).
I've looked at the jQuery form plugin (http://jquery.malsup.com/form/#file-upload), but apparently it uses an iframe to upload files, so I'm not sure if it will achieve what I need.
Thanks for any help,