简体   繁体   English

从uploadify jquery插件获取文件名

[英]get file names from uploadify jquery plugin

that is my first post 那是我的第一篇文章

I am trying here, to get the names of the files that are uploaded, so that the user can delete it if desired, the same way as yahoo. 我在这里尝试获取上传文件的名称,以便用户可以根据需要将其删除,方法与yahoo相同。

$("#uploadifysub1").uploadify({ 'uploader' : 'JS/uploadify.swf', 'script' : 'JS/uploadify.php', 'cancelImg' : 'cancel.png', 'buttonImg' : 'attach.png', 'folder' : 'uploads', 'queueID' : 'divquickuploadProgress1', 'auto' : true, 'multi' : true });

the problem is that I cannot get files names, any suggestions? 问题是我无法获取文件名,有什么建议吗?

is there any function in uploadify, that can remove an uploaded file, or I have to do that myself?? uploadify中有什么功能可以删除上传的文件,还是我必须自己做?

Thanks in advance. 提前致谢。

thanks to "Codler", I could solve this problem, I will share the code, maybe it will help. 感谢“ Codler”,我可以解决此问题,我将共享代码,也许会有所帮助。

$("#uploadifysub1").uploadify({
        'uploader'       : 'JS/uploadify.swf',
        'script'         : 'JS/uploadify.php',
        'cancelImg'      : 'cancel.png',
        'buttonImg'      : 'attach.png',
        'folder'         : 'uploads',
        'queueID'        : 'divquickuploadProgress1',
        'auto'           : true,
        'multi'          : true,
        'onComplete'     : function(event, queueID, fileObj, reposnse, data) {
            // write your own implementation
                           }
    });

my implementation was like that 我的实现是这样的

var cod = '<tr>';
cod += '<td align="left">'+fileObj.name+'</td>';
cod += '<td align="left">';
cod += '<span onclick="removeprev(this,'+fileObj.name+')" style="cursor: pointer;">&nbsp;';
cod += '[remove]</span>';
cod += '</td>';
cod += '</tr>';
$('#uploaded_files').append(cod);

Thanks again 再次感谢

Quote from uploadify 引用uploadify

fileDataName fileDataName

The name of your files array in the upload server script. 上传服务器脚本中文件数组的名称。 Default = 'Filedata' 默认='文件数据'

PHP code PHP代码

$_FILES['Filedata']['tmp_name'];

why didn't you just set the removeCompleted option to false. 为什么不将removeCompleted选项设置为false。 It queues all the uploaded files. 它将所有上传的文件排队。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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