Diego Alves
Diego Alves

Reputation: 2687

How to display a message when the file upload limit exceeds a size in primefaces

That's my attempt I hoped that when I selected the file a message would appear.

<p:fileUpload id="up" fileUploadListener="#{acidenteTransitoFace.handleFileUpload}" mode="advanced"
                                              label="Incluir aanexo"  messageTemplate="Errado!" 
                                              auto="true" sizeLimit="1" update="@this,tableAnexo,up"/>
                                
                                            <p:message for="up"  showSummary="false"/>
                                

Upvotes: 1

Views: 1009

Answers (1)

ivasanpag
ivasanpag

Reputation: 169

Although you have not indicated the primefaces version that you are using, you only need to include the property "invalidSizeMessage" and the message what you want to show to the user.

Example:

      <p:fileUpload label="" skinSimple="true" auto="true" id="fileUploadFile"
                    fileUploadListener="#{bean.method}"
                    sizeLimit="20848820" invalidSizeMessage="your_invalid_size_message"
                    update="..." />

Upvotes: 3

Related Questions