SpringMVC图片上传问题解决

当咱们上传图片时一直发现:前端

MultipartFile file = null;web

if (request instanceof MultipartHttpServletRequest)  匹配不上,spring

 

解决方案: 在前端xml加入以下配置代码便可3d

<!-- 图片上传bean -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">  
        <!-- set the max upload size100MB -->  
        <property name="maxUploadSize">  
            <value>104857600</value>  
        </property>  
        <property name="maxInMemorySize">  
            <value>4096</value>  
        </property>  
    </bean>  xml

 

示意图:blog

相关文章
相关标签/搜索