jQuery iframe upload. Handle network errors
<p>This code works, except now I need to handle network errors.</p>

<p>For example if the network is turned off while a file is uploading. I need to handle errors like these.</p>

<p>How can I proceed?</p>

<pre><code>var name = 'iframeUpload';
var cur = $(this);
var iframe = $('&lt;iframe name="' + name + '" id="' + name + '" style="display: none" /&gt;');

$("body").append(iframe);

cur.attr("action", "upload/test");
cur.attr("method", "post");
cur.attr("enctype", "multipart/form-data");
cur.attr("encoding", "multipart/form-data");
cur.attr("target", name);
cur.attr("file", $(this).val());
cur.submit();

$('#' + name).load(function () {

});
</code></pre>
