Home  >  Forum  >  Spring
Post New Query

HTTP Status 400-Required MultipartFile parameter 'file' is not present


joined on
April 01,2014
Asked on August 05,2014
Hi All,
I am creating a Spring MVC application to upload the file. My controller is like

@RequestMapping(value="/upload", method=RequestMethod.POST )
    public @ResponseBody String upload(@RequestParam("file") MultipartFile file){
}

And the jsp is 

<form method="POST" enctype="multipart/form-data"
action="upload">
File to upload: <input type="file" name="file"><br /> 
<input type="submit" value="Upload"> Press here to upload the file!
</form>


Unable to understand why  I  am getting error on browser as

HTTP Status 400 - Required MultipartFile parameter 'file' is not present

type Status report

message Required MultipartFile parameter 'file' is not present

description The request sent by the client was syntactically incorrect.
Apache Tomcat/7.0.42

joined on
October 10,2013
Replied on August 09,2014

Check for below jar, it you have gradle it will look like


dependencies {
   compile 'org.springframework.boot:spring-boot-starter-web:1.1.4.RELEASE'
   compile 'org.springframework.boot:spring-boot-starter-security:1.1.4.RELEASE'
   compile 'javax.servlet:jstl:1.2'
   compile 'commons-fileupload:commons-fileupload:1.3.1'
}


Write Answer








Copyright ©2017 concretepage.com, all rights reserved |Privacy Policy | Contact Us