1

I'm having some issues with fileUpload. It's not firing the fileUploadListener when the file is > 2 Mb.

The component:

<p:fileUpload id="upload" required="true"
fileUploadListener="#{myBean.handleFileUpload}"
fileLimit="1"
requiredMessage="A file is required"
fileLimitMessage="One file only"
invalidFileMessage="Invalid file"
cancelLabel="Cancel" label="Choose"
allowTypes="/(\.|\/)(gif|jpe?g|png)$/" />

Enviroment: JSF 2.2.3, Primefaces 4.0, Tomcat 7

Might it be some "filter" configuration problem?

@EDIT: More info. Same problem with mode="simple".

1
  • Was this problem only from within the prettyfaces rewritten urls? In my case it worked fine but except with the pretty rewritten urls that showed this limitation ! Feb 17, 2015 at 6:01

1 Answer 1

4

Tomcat has a default maximum POST size of 2MB which is configurable in the HTTP <Connector> configuration in its /conf/server.xml. Here's an extract from the documentation:

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).

Thus, if you want to disable it, do so:

<Connector ... maxPostSize="-1">

(0 can also, but the -1 is more self-documenting as to "allow every size")

1
  • Could I somehow specify it within the context.xml file inside my application ? Feb 16, 2015 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.