I occurred this problem too, there are few upload examples in the
https://github.com/ralscha/extdirectspring/wiki/Form-Post-With-Upload, where can I download the examples(backend site)?
Ext.define('MasterData.StoredFileForm',{
"extend" : "Form.BasicForm",
"paramsAsHash" : true,
"fileUpload": true,
"items" : [ {
"hidden" : true,
"xtype" : "textfield",
"name" : "id",
"fieldLabel" : "Id"
}, {
"xtype" : "combo",
"name" : "fileType",
"fieldLabel" : "File Type",
"store" : {
"type" : "array",
"fields" : [ "fileType" ],
"data" : [ [ "image" ], [ "file" ] ]
},
"displayField" : "fileType",
"valueField" : "fileType"
}, {
"xtype" : "filefield",
"name" : "file",
"fieldLabel" : "File",
"allowBlank" : false
} ],
"layout" : null,
"width" : 300,
"height" : 130,
"defaults" : {
"bodyStyle" : "padding:20px",
"labelAlign" : "right"
},
"api" : {
"load" : "commonService.getRecord",
"submit" : storedFileService.saveRecord
},
"initFromServer" : false,
"loadFromList" : false,
});
//---------------------------------------------------- server side
@Service
public class StoredFileService extends CommonService {
@ExtDirectMethod(ExtDirectMethodType.FORM_POST)
public ExtDirectFormPostResult saveRecord(
@RequestParam("file") MultipartFile file) throws IOException {
ExtDirectFormPostResult resp = new ExtDirectFormPostResult(true);
if (file != null && !file.isEmpty()) {
resp.addResultProperty("fileContents", new String(file.getBytes(),
StandardCharsets.UTF_8));
}
return resp;
}
}
it even did not call the service