<!--SPRINGMVC You need to configure the Multipartresolver processor when uploading files - <BeanID= "Multipartresolver"class= "Org.springframework.web.multipart.commons.CommonsMultipartResolver"> < Propertyname= "Defaultencoding"value= "UTF-8"/> <!--Specifies that the total size of the uploaded file cannot exceed 200KB. Note the limitations of the Maxuploadsize attribute are not for individual files, but for the sum of the capacity of all files - < Propertyname= "Maxuploadsize"value= "200000"/> </Bean> <!--Springmvc throws org.springframework.web.multipart.MaxUploadSizeExceededException when the upload file limit is exceeded - <!--This exception is thrown when Springmvc checks the uploaded file information and is not in the Controller method at this time . - <BeanID= "Exceptionresolver"class= "Org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> < Propertyname= "Exceptionmappings"> <Props> <!--automatically jump to/web-inf/jsp/error_fileupload.jsp page when encountering Maxuploadsizeexceededexception exception - <propKey= "Org.springframework.web.multipart.MaxUploadSizeExceededException">Error_fileupload</prop> </Props> </ Property> </Bean>
Spring MVC file Spring file configuration