使用FormData异步提交文件上传

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>




	
		
		
		出错了
		
		
	
	

	
	
		







下载

jquery.form.js 上传文件

<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>




	
		
		
		出错了
		
		
		
		
	
	

	
		
		


@RequestMapping("test")
@ResponseBody
public Map test(MultipartFile file,String rydm,String rymc) {
    Map map = new HashMap<>();
    map.put("msg", "rydm="+rydm+",rymc="+rymc+",filename=" + file.getOriginalFilename());
    return map;
}

 

你可能感兴趣的:(web,ajax)