我正试图在extjs中上传一个文件(截至目前的任何扩展名).我有一个模特和商店.文件上传发生在一个窗口,我没有在窗口中的表单.我在网上尝试的所有例子都是使用form.submit().我改为使用和Ajax调用如下所示将数据发送到服务器.
Ext.Ajax.request({
url : 'qaf/saveSetupDetails.action',
params : {
'data' : recordsToSend
},
failure : function(response){
//console.log('error connecting controller');
},
success : function(response){
//console.log('successfully submitted');
}
});
Run Code Online (Sandbox Code Playgroud)
要在数据中发送的记录如下所示.
var store = Ext.getStore('SomeStore');
var modifiedRecords = store.getModifiedRecords();
var recordsToSend = [];
if(modifiedRecords.length > 0){
Ext.each(modifiedRecords, function(record){
recordsToSend.push(record.data);//I'm sure that this is so dump but this is how I do it for other records which are string and not sure how to do it for a file...
});
}
Ext.USE_NATIVE_JSON = true;
recordsToSend …Run Code Online (Sandbox Code Playgroud) extjs4.2 ×1