0

当我选择一个文件时,上传不会自动开始。仍然需要通过单击上传按钮手动上传。

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

有没有办法使这项工作?我使用richfaces 4.2.1。

4

1 回答 1

2
  1. 首先将 fileupload.js 复制到您的应用程序中,并在您的页面中添加相同的内容,如下所示:

    <script type="text/javascript" src="#{facesContext.externalContext.requestContextPath}/js/fileupload.js"></script>
    
  2. 第二个去 fileUpload.js 并找到一个名为的函数__updateButtons并更新第一个 if 它正在检查项目长度this.__startUpload()

    如下所示。

    __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 {
    
于 2012-08-24T10:19:59.253 回答