Site icon Hip-Hop Website Design and Development

Importing PDF utilizing Media Uploader

I’ve been utilizing a customized code to add photos to WordPress utilizing customized metaboxes. Right here is the code:

<script sort="textual content/javascript">

    jQuery(doc).prepared(perform( $ ) {

        var formfield;

        $('.upload_button').click on(perform() {
            $('html').addClass('Picture');
            formfield = $(this).prev('.upload_image'); // .attr('title');
            tb_show('', 'media-upload.php?sort=picture&TB_iframe=true');
            return false;
        });

        // person inserts file into submit. solely run customized if person began course of utilizing the above course of
        // window.send_to_editor(html) is how wp would usually deal with the acquired knowledge

        window.original_send_to_editor = window.send_to_editor;
        window.send_to_editor = perform(html){

            if (formfield) {
                fileurl = jQuery('img',html).attr('src');

                $(formfield).val(fileurl);
                tb_remove();
                formfield = '';
                $('html').removeClass('Picture');

            } else {
                window.original_send_to_editor(html);
            }
        };

    });


</script>

My precise drawback is that I’ve to add now a PDF. I’ve attempt to use the .urlfield enter within the media uploader with retains the URL of the uploaded file.

I’ve modified fileurl = jQuery(‘img’,html).attr(‘src’); to fileurl = jQuery(‘.urlfield’,html).val(); nevertheless it doesn’t work.

What can I do please?

An alternate tip I wish to know is how can I modify the “Insert button” worth textual content to one thing like “Use this file”.

Thanks prematurely.