Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fileupload: support multiple files in simple mode #4038

Closed
mertsincan opened this issue Sep 13, 2018 · 5 comments
Closed

fileupload: support multiple files in simple mode #4038

mertsincan opened this issue Sep 13, 2018 · 5 comments
Assignees
Labels
6.2.10 enhancement Additional functionality to current component
Milestone

Comments

@mertsincan
Copy link
Member

mertsincan commented Sep 13, 2018

Reported By PRO User;

We are using p:fileupload component with simple mode.

<p:fileUpload mode="simple" multiple="true" value="#{fileUploadView.file}"/>.
<p:commandButton value="Submit" ajax="false" actionListener="#{fileUploadView.upload}" />

Our requirement is to use the simple fileupload and upload multiple files.
After setting multiple="true", we are able to select multiple files but clicking on upload button, only one file is uploaded.

Added UploadedFile.getFileNames() method to access uploaded files. Exp; file.getFileNames();

@mertsincan mertsincan self-assigned this Sep 13, 2018
@mertsincan mertsincan added enhancement Additional functionality to current component 6.2.10 labels Sep 13, 2018
@mertsincan mertsincan added this to the 6.3 milestone Sep 13, 2018
@Rapster
Copy link
Member

Rapster commented Sep 14, 2018

@cnsgithub
Copy link
Contributor

@mertsincan @Rapster Added another commit comment here: ad123a5#r31276355

@cnsgithub
Copy link
Contributor

Sorry for blaming once again, but I cannot agree with changes made in this commit since it's very poor design.

Please have a look at NativeUploadedFile class, it needs some refactoring to properly support multiple files.

Depending on the CTOR being called we either have the single vs. multiple file upload situation. Since there are two separate field members, part and parts, the other will stay null and therefore is predestinated for NPEs thrown later on. E.g. methods getSize or getInputstream are suitable for the single file upload case only.

@Rapster @tandraschko What do you think?

@Rapster
Copy link
Member

Rapster commented Nov 13, 2018

I definitely agree with your analysis. We'll have to think of a better design... Whenever I have some time, I'll try to propose something

@Rapster
Copy link
Member

Rapster commented Dec 2, 2018

BTW, in such definition (e.g mode simple + multiple true) only one filename is displayed. Would be nice to fix this before 6.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.2.10 enhancement Additional functionality to current component
Projects
None yet
Development

No branches or pull requests

3 participants