I'm trying to make a file upload form using the hidden iframe method. In other words, I have a form like so....
<form action="upload" target="uploadFrame"
method="post" enctype="multipart/form-data">
<!--There are other hidden fields that i've omitted for the sake of brevity -->
<input type="file" id="file" name="file" />
</form>
And then I have javascript function that calls sumbit()
on that form.
I want the action "upload" to respond with an HTTP 200 OK
containing some arbitrary status. I've found a few different methods for obtaining the content of an iframe from its parent document.
Where I'm finding this whole method to be problematic is coming up with a reliable means of detecting and handling error cases such as 1) browser failing to connect to server, 2) connection dropping while uploading the file, 3) server sending an error response that does not include an entity. In other words, the types of errors where a browser generated response will usually be displayed in the frame.
Any suggestions would be appreciated. But I'd really prefer to keep it pure javascript (i.e. no jQuery or other frameworks).