1

This code works, except now I need to handle network errors.

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

How can I proceed?

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

$("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 () {

});
4

0 回答 0