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

Rodrigo
  • 385
  • 3
  • 12
  • 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 ! – Rajat Gupta Feb 17 '15 at 06:01

1 Answers1

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

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555