Adding URL of PDF from Thickbox in a Meta Box

This line…

imgurl = jQuery('img',html).attr('src');

Means that jQuery is getting the “source” (i.e. full path) of the image. As you’ve guessed, that won’t work for a PDF file.

What you’ll probably have to do is get the id of the attachment instead. Could you possibly update your original answer with the HTML SOURCE of the thickbox? We might be able to find the ID from somewhere and amend that jQuery line.

Once you’ve got the ID of the attachment, you can use the following code to display the URL in your HTML whether it’s an image or any other type of attachment:

<?php wp_get_attachment_url( $id ); ?>

Hope that helps.