Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 170 Vote(s) - 3.58 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SPRING REST: The request was rejected because no multipart boundary was found

#1
I did a POC for spring 3 rest multipart file upload. Its working fine. But when i tried integrating with my application i am facing issues.

It throws following exception:

org.springframework.web.multipart.MultipartException: Could not parse multipart servlet request;
nested exception is org.apache.commons.fileupload.FileUploadException:
the request was rejected because no multipart boundary was found**"

Please let me know if I am wrong in any part of my code.

Beans:

<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
<property name="order" value="1" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json" />
<entry key="xml" value="application/xml" />
<entry key="file" value="multipart/mixed" />
</map>
</property>
</bean>
<!-- multipart resolver -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- one of the properties available; the maximum file size in bytes -->
<property name="maxUploadSize" value="50000000" />
</bean>
Controller:


@Controller
public class MultipleFilesRecieve {
@RequestMapping ( value = "/saveMultiple", method = RequestMethod.POST )
public String save( FileUploadForm uploadForm ) {
List<MultipartFile> files = uploadForm.getFiles( );
List<String> fileNames = new ArrayList<String>( );
if ( null != files && files.size( ) > 0 ) {
for ( MultipartFile multipartFile : files ) {
String fileName = multipartFile.getOriginalFilename( );
fileNames.add( fileName );
}
}
return "multifileSuccess";
}
}


Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through