Pause/ Resume Functionality in jfileupload HTML version

Upload core product.

Pause/ Resume Functionality in jfileupload HTML version

Postby amrish_deep » Thu Mar 30, 2017 4:22 am

Hi

Please let us know how to create Pause/Resume button and functionality in Jfileupload HTML version.
amrish_deep
 
Posts: 40
Joined: Tue Jun 17, 2008 5:14 am

Re: Pause/ Resume Functionality in jfileupload HTML version

Postby support » Sun Apr 02, 2017 2:21 pm

You can use JavaScript API ton update button content. For instance, based on JavaScript sample, you can have something like:

Code: Select all
...
// "jfucontainer" is DIV identifier where you want it to be displayed.
var jfu = new JFU("jfucontainer", params);

// Do some UI updates from JavaScript API.
function oneForAllCallback(source, event) {
   var startTransferButton = document.getElementById("jfu-starttransfer");
   var cancelTransferButton = document.getElementById("jfu-canceltransfer");
   if (event.type == "onInfoStarted") {
      cancelTransferButton.value = "Pause";
      console.log(event.type);
   }
   else if (event.type == "onUploadStarted") {
      cancelTransferButton.value = "Pause";
      console.log(event.type);
   }
   else if (event.type == "onUploadCompleted") {
      console.log(event.type);
   }
   else if ((event.type == "onUploadFailed") || (event.type == "onUploadTimeout")) {
      cancelTransferButton.value = "Cancel";
      console.log(event.type);
   }
   else if (event.type == "onTransferAborted") {
      cancelTransferButton.value = "Cancel";
      startTransferButton.value = "Resume";
      console.log(event.type);
   }
   else if (event.type == "onTransferDone") {
      cancelTransferButton.value = "Cancel";
      startTransferButton.value = "Start";
      console.log(event.type);
   }      
}

// Register to all JSAPI callback available under jfu.JSAPI array.
for (var l = 0; l < jfu.JSAPI.length; l++) {
   jfu.addEventListener(jfu.JSAPI[l], oneForAllCallback);
}

..
User avatar
support
 
Posts: 1500
Joined: Sun Jan 27, 2008 6:19 pm


Return to JFileUpload



cron

Sitemap | Privacy Statement | Java and all Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc.
in the U.S. and other countries. All other company and/or product names are the property of their respective owners.