2011-10-17 30 views
0

我得到了我的valum上传插件this plugin这个代码,我想获得的文件名在$。员额的方法来使用它,但我不知道如何,任何建议?我需要的qq.FileUploader插件之外的文件名如何将valum上传插件的文件名传递给post方法?

var uploader = new qq.FileUploader({ 
        element: document.getElementById('demo'), 
        listElement: document.getElementById('separate-list'), 
        action: '../../correo/controller/controllerSubirArchivos.php', 
        // name: 'qqfile', 
        debug:false, 

        allowedExtensions:['jpg', 'jpeg', 'png', 'gif', ], 
        sizeLimit: 10000000, //10MB maximo 
        onSubmit: function(id, fileName){ 

         //alert (fileName); 

        } 

       }); 

我在寻找,但我没有找到如何?任何帮助非常赞赏

回答

1

我真的不知道我明白你的意思。您可以将文件名存储在例如一个全局变量,当你需要它使用它:

var UploadedFileNames = []; 

var uploader = new qq.FileUploader({ 
    element: document.getElementById('demo'), 
    listElement: document.getElementById('separate-list'), 
    action: '../../correo/controller/controllerSubirArchivos.php', 
    // name: 'qqfile', 
    debug:false, 
    allowedExtensions:['jpg', 'jpeg', 'png', 'gif', ], 
    sizeLimit: 10000000, //10MB maximo 
    onSubmit: function(id, fileName){ 
     UploadedFileNames.push(fileName); 
    } 
}); 

// later ... 
$.post({ }); // you can use UploadedFileNames here 
// if you want to have all the filenames concatenated, you can do: 
alert(UploadedFileNames.join(' ')); 
+0

谢谢回答你知道如何连接两个文件名?我的意思是你的解决方案的工作完美,但如果我有两个文件等等?? – bentham

+0

@GeorgeBecj - 我已经更新了我的示例以将文件名存储到数组中;你可以用'.join'连接它们。 – deviousdodo

+0

感谢您的回答再次完美地感谢 – bentham

相关问题