Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9023791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:50:49+00:00 2026-06-16T05:50:49+00:00

I am using (Java Server Faces 2.2) Primefaces 3.2 simple file upload controller. I

  • 0

I am using (Java Server Faces 2.2) Primefaces 3.2 simple file upload controller. I need to access file info before upload. What listener can I use when a file is selected & how do i get file info in the ManagedBean before initiating the upload

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:50:50+00:00Added an answer on June 16, 2026 at 5:50 am

    The tag does not support any ajax behavior event, so the only thing you can do is to call a method before the upload starts using the “onstart” attribute of that fires when upload starts.
    Using a remote command you can do something like:

    <p:remoteCommand name="beforeUpdate" partialSubmit="true" process="@this" 
                                     actionListener="#{myBean.doBefore}" value="" />
    

    add call to remote command to the fileUpload

    <p:fileUpload fileUploadListener="#{itemImportDialogController.uploadListener}" 
             mode="advanced" multiple="true" onstart="beforeUpdate()"
             styleClass="importItems" update=":itemImportView:fileForm" style="margin: 10px 0"/>
    

    and in the bean add a method like this

    public void doBefore() {
         //DO SOME WORK
    }
    

    About file name you can retrieve it only when the file is being uploaded

    public void uploadListener(FileUploadEvent event) {
    
        UploadedFile file = event.getFile();
        //DO SOMETHING
    }
    

    because there is no ajax interaction possible between the component and the server before this.
    So I’m sorry but is not possible.

    By the way you could try to manage this through jQuery catching the event with something like

    $('input[type=file]').change(function() { 
        //GET THE FILE AND SUBMIT IT TO THE SERVER WITH AJAX CALL 
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently looking in to some file uploading using Java Server Faces. I've
I have a Java based web-application using Java Server Faces and Facelets. I am
Using Java sockets, I made a simple server. This works because it sends data
I have the following Java Server Faces 2.0 composite component. Notice i am using
I am using my-faces 2.1.5 primefaces 3.2 and WebLogic Server Version: 10.3.2.0 While I
I'm creating a web based application using Java Server Faces (JSF). I'm just wondering
I am using java on sql server and I have a DB problem of
I have developed a Java server using Eclipse that accepts TCP socket connection from
I am using IMAP protocol to fetch mails from Google server using java mail.
Does anyone have any code for connecting to a remote server using java and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.