0

When I select a file to upload and click on <p:commandButton> and if there is some validation error on any inputs and page gets refreshed the uploaded file disappear from the screen and I have to again select the file.

I would like that file instance already selected should not disappear.

How can I achieve this?

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

1 Answers1

1

I think this is not allowed by browsers due to security reasons check this answer : https://stackoverflow.com/a/968157/1460591

Remember Primefaces and JSF must fellow HTML standards

So on validation phase JSF can't just simply hack the input[type='file'] and force the selection to the submitted file value before something like this : inputFile.setValue(*filePathOfSubmittedFileBefore*) NOT ALLOWED

USER ONLY CAN SELECT FILE NO ONE ELSE

Community
  • 1
  • 1
Youans
  • 4,801
  • 1
  • 31
  • 57