white knight

导航

 
前端:
{type : "upload", mode : "html4", name : "importFile", inputWidth : 300, url : "/base/baseSkuProp/import"}

fileForm.attachEvent("onUploadComplete", function() {
alert("导入成功");
});

fileForm.attachEvent("onUploadFail", function(fileName, extra) {
alert(extra.msg);
});


后端:
@RequestMapping("/import")
public String importExcel(MultipartFile file) {
try {
//处理file...

return "{state : true, name : '" + file.getOriginalFilename() + "', size : " + file.getSize() + "}";
    } catch (Exception e) {
e.printStackTrace();
return "{state : 'fail', extra : {msg : '" + e.getMessage() + "'}}";
}
}
posted on 2018-03-08 11:00  white knight  阅读(192)  评论(0编辑  收藏  举报