通过使用CommonsMultipartResolver库在Spring中上传10 MB大小的csv文件时遇到错误。我已经在xml文件Xml File Confi中进行了以下设置:
<beans:bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- max upload size in bytes -->
<beans:property name="maxUploadSize" value="99971520" /> <!-- 99MB -->
<!-- max size of file in memory (in bytes) -->
<beans:property name="maxInMemorySize" value="1048576" /> <!-- 1MB -->
Run Code Online (Sandbox Code Playgroud)
控制器代码:
@RequestMapping(value="/uploadForm",method = RequestMethod.POST)
public @ResponseBody String uploadForm1(@ModelAttribute("admin") BillingAndRecon billingandrecon,@RequestParam String id,BindingResult result,Principal principal,@RequestParam MultipartFile file,HttpSession session) throws ServiceException, DaoException, IllegalStateException, IOException {
File uploadFile = null;
String msg = "";
if (!file.getOriginalFilename().equals("")) {
logger.info("Before Multipart file get path >> ");
BillingAndReconServiceImpl …Run Code Online (Sandbox Code Playgroud) spring-mvc ×1