Jquery window.send_to_editor

后端 未结 9 1168
慢半拍i
慢半拍i 2020-12-24 09:22

Couldn\'t come up with a good title for this.

I\'ve got a build in WordPress where I have multiple image uploads using the built in WordPress media uploader. How it\

9条回答
  •  一整个雨季
    2020-12-24 10:03

    I used this for uploading audio:

    jQuery(document).ready(function($) {
        $('#upload_button').click(function() {
            tb_show('Upload a Podcast MP3 file', 'media-upload.php?referer=my-settings&type=audio&TB_iframe=true&post_id=0', false);
            return false;
        });
        window.send_to_editor = function(html) {
            console.log(html);
            var file_url = $($.parseHTML(html)).attr('href');
            console.log(file_url);
            $('#my_input_field').val(file_url);
            tb_remove();
        }
    });
    

提交回复
热议问题