0

I have a custom meta filed with upload file functionality but the problem is I can't get the fileurl button value when hit "insert into Post" below are my jQuery code

window.send_to_editor = function(html) 

    {
        dlink = jQuery('button.urlfile',html).attr('title');
        jQuery('#download_link').val(dlink);
        tb_remove();
    }


    tb_show('', 'media-upload.php?post_id=1&type=image&TB_iframe=true');
    return false;

Tried also this code search from internet but nothing happen it doesent get the File URL

window.send_to_editor = function(html){
    dlink = jQuery('img',html).attr('src');
    jQuery('#download_link').val(dlink);
    tb_remove();
}

1 Answer 1

1

The second version uses and image source, so that won't work with a file upload.

dlink = jQuery(html).attr('href');

Should work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.