javascript - uploadify.js get id of clicked item -


i need retreive id of button clicked launch file upload uploadify(). have parse id extract number , pass on upload.php script. format of id :

upload_1 upload_2 ..... upload_xx 

the button (divs) being created in php with:

while (....) {     echo "<div class='upload' id='upload_" . $row['did'] . "' data-role='none' title='upload documents'>"; } 

i need retreive xx ($row['did']) part.

this script have:

<?php $timestamp = time();?> $(function() {     $('div[id*="upload_"]').uploadify({         'buttontext'    : '&#x21e7;',         'method'            : 'post',         'uploadlimit'  : 2,         'width'             : 24,         'height'        : 24,         'title'         : 'upload docs',         'buttonclass'   : 'uploadbutton',         'swf'           : 'inc/uploadify/uploadify.swf',         'uploader'      : 'inc/uploadify/uploadify.php',         'onuploadstart': function (file, event) {                 alert($(this).attr("id"))                 $(this).uploadify('settings','formdata',{                     'driver': $(this).attr("id").tostring().replace('upload_',''),                     'timestamp' : '<?php echo $timestamp;?>',                     'token'     : '<?php echo md5('unique_salt' . $timestamp);?>',                 })         }     }); }); 

console.log output:

n.fn.init[1]0: swfuploadbutton: n.fn.init[1]bytesloaded: 0customsettings: objecteventqueue: array[0]movieelement: object#swfupload_0.swfuploadmoviename: "swfupload_0"original: n.fn.init[1]queue: n.fn.init[1]queuedata: objectsettings: objecttimer: 1433418517151wrapper: n.fn.init[1]__proto__: swfuploadlength: 1__proto__: n[0] 

 var ids = new array();   $('#file_upload').uploadify({         'uploader': swfurl,         'script': ashxurl,         'cancelimg': cancelurl,         'folder': uploadsurl,         'auto': true,         'fileext': '*.jpg;*.gif;*.png;*.psd;*.jpeg',         'filedesc': 'graphics files',         'removecompleted': false,         'buttontext': 'upload psd',         'multi': true,         'queueid': 'divparent',         'oncomplete': function (event, id, fileobj, response, data) {             ids.push(response);         }, 'onselect': function (event, id, fileobj)         {              alert(event.target);             alert($(event.target).prop('id'));             customfilearray.push({ id: id, file: fileobj, upload: false });         }     }); 

to value call following code.

 $("#ids").val(ids.join(',')); 

just omit unwanted code have used , think enough understanding

let me know if still have issue


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -