您的位置:首页 > 编程语言 > Java开发

spring 支持文件上传配置

2015-10-21 15:26 344 查看
spring 文件上传时遇到错误信息:

Servlet.service() for servlet [springmvc] in context with path [/**] threw exception [Required MultipartFile[] parameter 'photos' is not present] with root cause

org.springframework.web.bind.MissingServletRequestParameterException: Required MultipartFile[] parameter 'photos' is not present

用MultipartFile接收文件需增加配置:

<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">

<!--可设置上传文件大小限制,1024*200即200k-->

<property name="maxUploadSize" value="204800"/>

</bean>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: