简体   繁体   中英

immediateUpload / autoUpload with rich:fileupload

The upload doesnt start automatic when i choose a file. Still need to upload it manual by clicking the upload-button.

<rich:fileUpload ....
        immediateUpload="true">

Is there a way to make this work? Im using richfaces 4.2.1.

  1. First copy the fileupload.js in to your application and add the same in your page like below:

     <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/fileupload.js"></script> 
  2. Second go to fileUpload.js and find a function called __updateButtons and update the first if which is checking the items length with the this.__startUpload() ;

    like below.

     __updateButtons: function() { if (!this.loadableItem && this.list.children(".rf-fu-itm").size()) { if (this.items.length) { //this.uploadButton.css("display", "inline-block"); this.__startUpload();// New - Added the immediate upload to work. } else { 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM