This may help :
1st thing we have to check is -
multipartResolver maxUploadSize: maximum upload size for a single request. That means the total size of all upload files cannot exceed this configured maximum. Default is unlimited (value of -1).
2nd thing we have to check is -
which server you are using to run your application?
If it is tomcat then,
you have to do some configuration in it
Refer : https://tomcat.apache.org/tomcat-7.0-doc/config/http.html
maxPostSize
The maximum size in bytes of the POST which will be handled by the container FORM URL parameter parsing. The limit can be disabled by setting this attribute to a value less than or equal to 0. If not specified, this attribute is set to 2097152 (2 megabytes).
Another Limit is:
maxHttpHeaderSize The maximum size of the request and response HTTP header, specified in bytes. If not specified, this attribute is set to 4096 (4 KB).
You find them in
$TOMCAT_HOME/conf/server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
maxPostSize="4294967296"
redirectPort="8443" />
This will set the maximum file upload size to 4GB.
StreamUtilsand use an input stream instead of abyte[]that prevents loading the whole thing into memory.StreamUtils.copy(multipartFile.getInputStream(), new FileOutputStream( basePath + "/" + uploadedfile.getFileName()));But this take too long to create target uploaded file with 4GB size.