0

As simple as it can be, but it is not working

upload.xhtml

<p:fileUpload mode="advanced" skinSimple="true" auto="true" fileUploadListener="#{upload.fileUploadListener}" />

method

public void fileUploadListener(FileUploadEvent e){
        // Get uploaded file from the FileUploadEvent
        this.file = e.getFile();
        // Print out the information of the file
        System.out.println("Uploaded File Name Is :: "+file.getFileName()+" :: Uploaded File Size :: "+file.getSize());
    }

enter image description here

My environment is

Sprintboot - 2.0.2 PrimeFaces 6.x Mojarra 2.3.4 PrimeFaces Extensions 6.2.4

Melloware
  • 10,435
  • 2
  • 32
  • 62
Sarz
  • 1,970
  • 4
  • 23
  • 43

1 Answers1

0

It is not a duplicate because of "Primefaces" term in the question. Sending large files is a matter of both client and server sides. On server-side, you have to do as shown into Spring upload file size limit. On client-side (the Primefaces based "view") you have to do like shown at fileUpload component's documentation, by adding maxChunkSize attribute to your code:

<p:fileUpload mode="advanced" maxChunkSize="1000000"
              auto="true" skinSimple="true"                  
              listener="#{upload.fileUploadListener}" />
Sabucodonozorr
  • 101
  • 1
  • 7