diff --git a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java index f6e6f6c6bc..02572b4069 100644 --- a/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java +++ b/spring-web/src/main/java/org/springframework/web/multipart/commons/CommonsFileUploadSupport.java @@ -100,7 +100,7 @@ public abstract class CommonsFileUploadSupport { } /** - * Set the maximum allowed size (in bytes) before uploads are refused. + * Set the maximum allowed size (in bytes) before an upload gets rejected. * -1 indicates no limit (the default). * @param maxUploadSize the maximum upload size allowed * @see org.apache.commons.fileupload.FileUploadBase#setSizeMax @@ -109,6 +109,17 @@ public abstract class CommonsFileUploadSupport { this.fileUpload.setSizeMax(maxUploadSize); } + /** + * Set the maximum allowed size (in bytes) for each individual file before + * an upload gets rejected. -1 indicates no limit (the default). + * @param maxUploadSizePerFile the maximum upload size per file + * @since 4.2 + * @see org.apache.commons.fileupload.FileUploadBase#setFileSizeMax + */ + public void setMaxUploadSizePerFile(long maxUploadSizePerFile) { + this.fileUpload.setFileSizeMax(maxUploadSizePerFile); + } + /** * Set the maximum allowed size (in bytes) before uploads are written to disk. * Uploaded files will still be received past this amount, but they will not be