commons fileupload progress listener

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leenadiwan
    New Member
    • Jan 2007
    • 22

    commons fileupload progress listener

    Has anyone implemented the commons file upload progres listener?

    1. Can it be used only with streaming API and not normal upload?
    2. Not sure where to put the following code referred on the site under watch progress:

    Code:
    //Create a progress listener
    ProgressListener progressListener = new ProgressListener(){
       public void update(long pBytesRead, long pContentLength, int pItems) {
           System.out.println("We are currently reading item " + pItems);
           if (pContentLength == -1) {
               System.out.println("So far, " + pBytesRead + " bytes have been read.");
           } else {
               System.out.println("So far, " + pBytesRead + " of " + pContentLength
                                  + " bytes have been read.");
           }
       }
    };
    upload.setProgressListener(progressListener);
    Also Im note sure to transform these sysouts into something to show actually on the upload page.

    Regards,
    Leena
Working...