PDA

View Full Version : Downloading file from database



Unkind
10 Jan 2012, 5:07 AM
I have error 'You're trying to decode an invalid JSON String: ęPNG ' when calling method: [nsIDOMEventListener::handleEvent]

What is it? Don`t find any answer(

I have image button in grid

xtype: 'actioncolumn',
width: 50,
items: [{
icon: 'Content/Resources/images/btnSave.gif',
tooltip: 'Edit',
handler: function (grid, rowIndex, colIndex) {
var rec = grid.getStore().getAt(rowIndex);
var id = rec.get('Id');

Ext.Ajax.jget({
url: 'Utilization/UtilizationFile/Download',
params: { id: id },
scope: this
});
}
},

and mvc controller


public ActionResult Download(int id)
{

var file = UtilizationFiles.GetUtilizationFileById(id);

return File(file.Data, file.ContentType);
}

What i do not?
I beginner in ext

mitchellsimoens
10 Jan 2012, 6:54 AM
Ext.Ajax isn't going to be able to allow a user to download a file if that's what you are trying to do.