Upload files larger than 20MB

Hi all,

I am using FileItem CAF component to upload files via portal page. It is allowing to upload files only upto 20MB :frowning: .

Is there any way to upload files of size >20MB via portal?

MWS has a global max upload size that is managed in the Content Service Admin portlet. By default, this is set to 20MB. Feel free to change this as you need.

If you want to have more fine grained control on a portlet application by portlet application basis, you can add the following JSF validator to your portlet app. However, no multipart Http POST will get to your code if it is larger than the global max upload file size.

This code sample limits the uploaded file to be 4MB

 * Validator to check file size 
public void customFile_validator(javax.faces.context.FacesContext context, javax.faces.component.UIComponent component, java.lang.Object value) { 
	if (value instanceof FileItem) { 
		FileItem fileItem = (FileItem)value; 
		long maxSize = 4 * 1024000; //4 MB 
		if (maxSize < fileItem.getSize()) { 
					//file is too big, so throw a validator exception 
					throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, 
											"File must be smaller than 4 MB", 
											"File must be smaller than 4 MB")); 

hi Mimel,

Thank you for the reply.
I set MAX FILE SIZE to 50 MB in Content Service portlet and tried to upload 21 MB size file.

It gave following exception:

org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21620270) exceeds the configured maximum (10485760)

In web.xml there is one init-param MAX_UPLOAD_DISK_SIZE for filter ‘Multipart Filter’. By default it was set to 10MB. I changed it to 50MB.
But still the same error is coming.

Not able to identify where the max upload size was set to 10485760 bytes.

Could you please let me know if you have any idea?

That is 10MB. 1024102410=10485760

I’ll try to repro this locally, but i’d like you to double check whether you redeployed and/or restarted MWS after making these changes.


hi Mark,

Restarted server deployed the code and checked again, giving the same exception
org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException: the request was rejected because its size (21620270) exceeds the configured maximum (10485760)

I suspect that, in some other configuration file MAX FILE SIZE is set to 10485760 bytes (10MB).

Raja sekhar

The default size for the Portlet’s Multipart Filter is 10MB. I wasn’t clear at all about where to set the Init Param, so i’ve attached a sample that you can try out and see where the Init Param should be set (look in the web.xml).

Below is a snippet of the web.xml

		Handles multipart form POSTs (file uploads); required by FileInput control.</description>
		<filter>Multipart Filter</filter>
			<param>30 MB</param>

LargeFileUploadApp.zip (9.36 KB)

Hello Mark.

I’ve tried to open your project but I was not able to.

I’m using 7.1.2 Designer.

I have the same problem as stated before, and after setting those values in the Web.xml we still get the same error “org.apache.commons.fileupload.FileUploadBase$SizeLimitExceededException”

Can you help?

Hi Mark.

I’ve managed to import your project to my Designer, sorry for the last Post.

In the meantime… I’ve looked at your code and your “Upload File” action button does nothing… and it’s an async button.

Are you able to upload a file with an async button?


In 7.x, you’ll need to use a SYNC command Button, but in 8.x you can use an Async command button.

Let me know if you need anything additional on this topic.

Ok, i think the issue is that i’m using 8.x for this sample. I’ll start investigating for 7.x.