views:

195

answers:

2

Hi, 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.

$("#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??

Thanks in advance.

A: 

Quote from uploadify

fileDataName

The name of your files array in the upload server script. Default = ‘Filedata’

PHP code

$_FILES['Filedata']['tmp_name'];
Codler
Do I have to make an ajax request to get that value?and $_FILES['Filedata']['tmp_name']; contains the name of last uploaded file, right??
omar
To get that value you only need to "echo" in php. catch it with "onComplete" in uploadify. See uploadify documentation on "onComplete", the parameter "response".
Codler
thanks alot that was a great help, I want to vote up but I cannot right now, again thanks a lot.
omar
A: 

thanks to "Codler", I could solve this problem, I will share the code, maybe it will help.

$("#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

omar