MultipartFile(文件的上传)

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="utf-8" />
        <property name="maxUploadSize" value="10485760000" />
        <property name="maxInMemorySize" value="40960" />
    </bean>
@RequestMapping("/doUpload.do")
	public ModelAndView doUpload(MultipartFile upfile) {
		String filename = upfile.getOriginalFilename();
		long bytes=upfile.getSize();
		System.out.println(filename);
		
		ModelAndView mv = new ModelAndView();
		mv.addObject("msg","upload ok");
		
		return mv;
	}

 

posted @ 2018-04-13 13:06  爱吃醋的工程师  阅读(584)  评论(0编辑  收藏  举报