Here's my predicament. In my JSP, I am trying to upload a file which in turns goes to a JS function. In my JS function, a dynamic iframe is being created, and has an onload function. The onload function creates a dynamic form element and goes on to submit it.
The underlying web server is IIS and if the file size is large, it throws an HTTP Error 404.13 and I get an HTML response. I want to be handle this and am unwilling to parse the HTML to look for error code. Kindly suggest how I should proceed.
My code looks something like this:
JSP content
<td>
<input type="image" id="uploadfile" src="../images/abc.gif" alt="Upload file" title="Upload File" />
<script type="text/javascript">
var uploadfile = document.getElementById('uploadfile');
upload({
element : uploadfile,
action : 'upload.jsp',
onstart : function(filename) {
document.getElementById("uploaded_file").innerHTML = "Uploading";
},
oncomplete : function(response_data) {
.......//some logic
}
});
</script>
</td>
JS content
function upload(d) {
var g = {
element : null,
action : "about:blank",
action_params : {},
maxsize : 0,
onstart : null,
oncomplete : null,
dataname : "Filedata",
target : null,
zindex : "auto"
};
.......//some logic
var c = document.createElement("div");
.......//some logic
c.innerHTML = '<iframe name="frameName" src="about:blank" onload="this.onload_callback()"></iframe>';
.......//some logic
var i = c.childNodes[0];
i.onload_callback = function() {
.......//some logic
var a = document.createElement("form");
.......//some logic
a.submit();
}
.......//some logic
}