PDA

View Full Version : How to cancel file upload ?



mnovoseltsev
27 Mar 2014, 6:59 AM
Hi all!

I use Ext.ux.form.FileUploadField class to upload file. Im looking for ability to cancel uploading, but I didnt find any proper solution.
Mine code:


function uploadProdWin(param) {
...


var editfrm = new Ext.FormPanel({
fileUpload:true,
waitMsgTarget:true,
labelWidth:70,
bodyStyle:'padding:5px',
frame:true,
baseParams:{contentGroupId:contentGroupId, img:param.img},
items:[
new Ext.form.FieldSet({
title:title,
autoHeight:true,
defaultType:'textfield',
items:[
{
xtype:'fileuploadfield',
emptyText:empTxt,
fieldLabel:labels.adm_file,
name:'content',
buttonText:'...',
allowBlank:false,
width:310,
listeners: {
fileselected: function (v) {
...
}
}
}
]
})
],
buttons:[
{text:labels.adm_uploadwindow, handler:function () {
form.submit({
url: rest,
waitMsg:labels.adm_wait_upload_file,
success:function (f, a) {
...
},
failure:function (f, a) {
...
}
});
}
},
{text:labels.adm_button_cancel, handler:function () {
selEdit.close();
}}
]
});


form = editfrm.getForm();


var selEdit = new Ext.Window({
title:labels.adm_uploadwindow,
modal:true,
width:470,
height:200,
resizable:false,
plain:true,
layout:'fit',
items:[editfrm]
});
selEdit.show();
}


File upload request is async, so if press upload and close window uploading will continue. Its very bad for me. Is there any solution to cancel uploading?

Thanks & regards