File Upload - Query on Multiple upload feature

UI Components for JSF
Post Reply
biswajit
Posts: 4
Joined: 04 Jan 2010, 14:27

04 Jan 2010, 14:44

Hi

I am using primefaces-ui-0.9.3.jar in my application for the Multiple File upload functionality.

I have embedded inside <p:dialog> tag the following:
<p:fileUpload fileUploadListener="#{fileUploadController.uploadFile}" multiple="true" label="Browse" allowTypes="*.jpg;*.png;*.gif;" description="Images"/>

Hence, I am able to show the uploading tool in a dialog. However, there is a need that:

(1) Once all the files have been uploaded by the upload tool, I need the total number of files successfully uploaded (also their names, sizes) in a javascript variable or a Html input field.
(2) Further, I also need to restrict the user from uploading more than 5 files at a time.

Is there a way to achieve these two needs in Primefaces?

Regards
Biswajit
Regards
Biswajit

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

05 Jan 2010, 13:55

Hi biswajit,

Why don't you do these checks on server side with file upload listener, you can keep track of uploaded files each time uploadListener is called.

biswajit
Posts: 4
Joined: 04 Jan 2010, 14:27

06 Jan 2010, 12:40

Hi

Condition 1): server side logic works.
Condition 2): I want to restrict the user from uploading more than 5 files at a time. If I let the user to upload any number of files, and check this restriction of 5 files in server side, it is an unnecessary extra work I have to do, further it is confusing for the user, and I think a user will always prefer to be informed of this restriction whenever he selects more than 5 files in the tool, instead of getting a server reply that 'cannot upload more than 5 files' after he has clicked the upload link.

In addition to these two queries, can you please let me know if I am using CustomUI option, how can I upload the files [ I mean how can I call the methods upload() and clear()] since as per the p:fileUpload tag lib there is no attribute 'widgetVar' defined for this tag, though in the guide pdf an example of fileUpload shows <widgetVar>.upload();
Regards
Biswajit

biswajit
Posts: 4
Joined: 04 Jan 2010, 14:27

07 Jan 2010, 07:35

Hi cagatay

Is there a work around for the Condition (2) and the Widget var for multiple file upload problem? In my project we are using Primefaces for the UI Rendering and we are stuck with these 2 problems.
Regards
Biswajit

monarathin
Posts: 1
Joined: 10 May 2013, 06:59

10 May 2013, 07:24

Hi biswajit,

Did you find any solution for your problem(Condition:2 - Restricting user from selecting more than 5 files). We are using Primefaces in our project and we are stuck up with this problem. It will be more helpful if you post the solution for this problem.

Thanks,
monarathin

User avatar
andyba
Expert Member
Posts: 2473
Joined: 31 Mar 2011, 16:27
Location: Steinfeld, near Bremen/Osnabrück, DE
Contact:

10 May 2013, 10:33

monarathin wrote:Hi biswajit,

Did you find any solution for your problem(Condition:2 - Restricting user from selecting more than 5 files). We are using Primefaces in our project and we are stuck up with this problem. It will be more helpful if you post the solution for this problem.

Thanks,
monarathin
You need to read the forum rules!
The chances of getting a reply from a 3 year old thread are nil.
PF 4.x (Elite versions), PF 5, Pf 5.1, PF 6.0
Glassfish 4.1, Mojarra 2.x, Java 8, Payara 4.1.1.
If you haven't read the forum rules read them now

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 13 guests