HI,
AM using filefield in extjs 5.
In this am submitting the form (form.submit()) to upload the file.
In this while getting the response, in Success:true case in IE11 it is showing Success:false and excutes the failure case only.
And in IE11 in case of success IE11 downloading some Json file.
In Success:true case handling the code like
below is my code.
Code:
uploadedFileSubmit:function(){
var uploadedFile = Ext.ComponentQuery.query('#btnFileUploadCreateTicket')[0];
var fileName = uploadedFile.getValue();
var gasDTO = {
fileName: '',
fileSystem: 'PU',
genericKey: 'PDF_UPLOADS',
tempInd: 'N'
};
var formAttachment = Ext.ComponentQuery.query('#containerattachments')[0];
formAttachment.submit({
method : 'POST',
url:'/vec/doc/billing/gas/saveMultiPartFormFile',
headers : {'Content-Type':'multipart/form-data'},
params: {
input: Ext.JSON.encodeValue(gasDTO)
},
waitMsg: 'Uploading your file',
waitTitle: 'Please Wait...',
success: function(form, action) {
var result = action.result;
if(result.success){
if(result.data.status == 'scan-failed'){
Ext.MessageBox.show({
title: 'Error',
msg: 'The attachment cannot be added, we have identified a virus in the attachment.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
formAttachment.reset();
return;
}
var win = Ext.WindowManager.getActive();
if (win) {
win.close();
Ext.MessageBox.show({
title: 'Success',
msg: 'Successfully file uploaded.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.SUCCESS,
fn: function(btn) {
if (btn === 'ok') {
Ext.ComponentQuery.query('#custmPdfRfrshBtnItemId')[0].fireEvent('click');
}
}
});
}
}
},
failure: function(form, action) {
if(Ext.isIE){
if((!action.result.success) && (action.result.errors.length == 0)){
var win = Ext.WindowManager.getActive();
if (win) {
win.close();
Ext.MessageBox.show({
title: 'Success',
msg: 'Successfully file uploaded.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.SUCCESS,
fn: function(btn) {
if (btn === 'ok') {
Ext.ComponentQuery.query('#custmPdfRfrshBtnItemId')[0].fireEvent('click');
}
}
});
}
}else {
Ext.MessageBox.show({
title: 'Error',
msg: fileName + '--> ' + 'An error occurred while processing your request. Please try again later.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
formAttachment.reset();
return;
}
}else {
Ext.MessageBox.close();
Ext.MessageBox.show({
title: 'Error',
msg: fileName + '--> ' + 'An error occurred while processing your request. Please try again later.',
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.ERROR
});
formAttachment.reset();
return;
}
}
});
}
I need the help in two cases.
1). Why is it giving the Success:false in case of Success:true.
2). Why Json file is downloadng in IE11.
Please help me in this.
Thanks in Advance
Kamalakar Reddy V