PDA

View Full Version : How to download a file.



atul.sachan@capgemini.com
27 Feb 2012, 2:12 AM
I am making an ajax call for downloading a file from server but unable to download it. I can see file content in the Browser console. any suggestion ????
My Code:
-----------------------------
init : function() {
downloadFrame = Ext.getBody().createChild({
tag: 'iframe'
, cls: 'x-hidden'
, id: 'iframe'
, name: 'firame'
});
console.log(downloadFrame);
this.control({


'searchpanel button[action=dtemp]' : {


click : this.downloadTemplate
}
});

}
, downloadTemplate:function(){
Ext.Ajax.request({
headers: { 'Content-Disposition': 'attachment; filename="PWB_Template.csv" ' },
url:'services/partService/downloadTemplate',
actionMethods : 'GET',
form: downloadFrame

,success:function(response, opts) {

}
,failure:function(response, opts) {
alert("Error code:"+response.status+" Error Message:"+response.statusText);

console.log('failure', arguments);
}
});
}
-----------------------
Regards,
At