springMVC利用jquery-form.js异步提交表单(上传文件)

笔记:springMVC利用jquery-form.js异步提交表单(上传文件)

html

<form id="file-input3" >
<input type="file" name="file3"/>
form>

js代码

$("#file-input3").ajaxSubmit({
                type:"post",
                url: basePath+"/userManger/addUserByFile",
                dataType:"text",
                success:function(msg){
                    alert(msg);
                }
             })

后台代码

@RequestMapping("/addUserByFile")
        public @ResponseBody String addUserByFile(@RequestParam("file3") MultipartFile file, HttpServletRequest request) throws IOException {   
            if(!file.isEmpty()){
                process..
            }

            return "success";
        }

你可能感兴趣的:(学习笔记)