Reputation: 49
I would like to implement a multiple fileUpload.
I don't want the upload and the cancel buttons to be appearing on screen,so basically there are two ways for me to proceed.
First way : Hiding the Upload and the Cancel buttons via CSS. I can hide them,the problem is that I can't trigger anymore the upload button,so files will never be uploaded.
In this case : is there a way to trigger the Upload button with a commandbutton ?
Second Way : adding auto="true" to the fileupload tag ,so the Upload and Cancel Buttons would disappear,but the problem with this way is that when the file is uploaded,it instantly disappears from screen,and the user can't no more click on the cancel icon next to the progress bar to cancel the upload.
So,in this case,is it possible to prevent the uploaded file from disappearing when the file is uploaded ?
I would like it to work like the google uploading file system when sending a mail , the user can choose to upload many files,but can still delete those if he chooses to (before sending the mail of course).
Upvotes: 2
Views: 1772
Reputation: 4345
You can activate p:fileUpload
's buttons from your own buttons like:
<p:commandButton value="My upload button" onclick="$('.ui-fileupload-upload').click(); return false;" />
The 3 buttons use the css classes
.ui-fileupload-choose
.ui-fileupload-cancel
.ui-fileupload-upload
Hide them with for example
.ui-fileupload-upload {
display: none;
}
Upvotes: 2