Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to reset the file limit counter on p:fileUpload?

Tags:

primefaces

We have a p:fileUpload to let a user upload an avatar image. If he wants he should be able to upload different ones in quick succession without having to reload the view; this would replace his current avatar every time. However, if fileLimit is set to 1, he has to reload the page to be able to use the component again. If it is any more (or unlimited (=0)) he is able to upload multiple files at once, which makes little sense. The multiple-attribute, if set to false, only restricts the file browsing-dialog to selecting a single file; it can still be opened again to add more files at will. Is it possible to allow uploading any amount of files, but never more than one file at once? We are using Primefaces 4.0.

like image 658
Zyl Avatar asked Aug 04 '14 21:08

Zyl


1 Answers

I had the same problem. Adding update="@this" to the p:fileUpload tag solved it.

like image 152
Felix Siegrist Avatar answered Nov 14 '22 10:11

Felix Siegrist