please use this code….
(function( $ ) {
$( '#uploadpdf' ).on( 'click', function() {
tb_show('Upload the pdf', 'media-upload.php?type=file&TB_iframe=1');
window.send_to_editor = function( html )
{
fileurl = $(html).attr('href');
if(/\.pdf\b/.test(fileurl)){
$('#pdf').val(fileurl);
}else{
alert('Not a valid pdf file');
}
tb_remove();
}
return false;
});
})(jQuery);
</script>
Related Posts:
- How to use media upload on metabox post page without breaking TinyMCE?
- Validating Custom Meta Box Values & Required Fields
- Add a Jquery Datepicker to custom field in post edit
- Arrange custom fields with drag and drop?
- Using media-upload.php to upload mp3 via custom fields
- Convert jQuery Datepicker Format to SQL Date Format
- Extend WP Customizer to make multiple image selection possible
- Saving Custom Field in Attachment Window in WordPress 3.5
- WordPress custom upload field error
- ajax jquery update custom field meta value front end
- limit amount of photos uploaded per cpt post
- Metabox with multiple fields added by user and upload box
- Metabox image upload and custom field
- Custom image sizes for custom field media uploads
- wp_handle_upload error “Specified file failed upload test” but still creates attachment?
- Insert attachment ID in custom field from media uploader
- sort search results by custom fields using dropdown
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- How to save media files under custom folder without changing wp-config.php or changing media settings
- How can I store a file in the database in the same way WordPress and ACF do?
- How do i save and retrieve custom attachment meta?
- Is there a simpler version of WP Media?
- Client PDF Upload (Catalogue) – Automatically update link to PDF
- How to add upload video option in wordpress for user?
- jQuery – Automatic event trigger does not **really** check my form
- Adding auto-complete to custom gravity field not working
- How to populate custom field dropdown box based on prior selection?
- Select multiple images from custom field
- Show user info in a hovercard [closed]
- WordPress Media Uploader custom Javascript not working
- WordPress colorpicker save both hex and RGB
- Front-End User Profile
- How do I convert all custom_field php timestamps in the database to js timestamps?
- Image upload and path to custom field
- Jquery on custom-field backend
- Trying to implement AJAX into my admin pages. Am I improperly enqueue and localizing my scripts?
- How to delete file uploaded by Plupload
- Problem uploading different files as custom fields with front end post form
- Meta field bulk editing no longer working in WP 6.0 [closed]
- How do I upload file through custom field, save it to database and get it
- How to save multiple custom user profile fields using repeater JQuery
- Can you generate a featured image from two images from custom fields?
- want to add video upload option for front end user
- display custom media folders to wordpress media popup
- Custom Meta Boxes and Fields for WordPress: Change directory upload based on user-edit page
- Get custom fields when hover link of post
- Change path to child of page when uploading image via custom field
- CSS conditional on custom field value
- Validating custom meta boxes with jQuery results in posts being saved as draft instead of published post
- How can I create more “create attachment” custom field – any idea?
- Upload image to wordpress
- show custom field content in jquery tabs
- Multiple image uploader under editor?
- unlink() doesn’t delete the uploaded file
- Save Custom Meta Value on Media Upload
- Single page WordPress website – custom fields or meta boxes or something else?
- Custom field Search with Relavanssi
- Collect Data from NEXT item while in loop
- Order custom fields alphabetically
- Retrieving custom field value with get_post?
- How to exclude custom fields from search queries?
- Add Custom Fields After Page Title
- Custom Theme Fields in Settings Menu – apply filters to one of those fields?
- KEY and VALUE custom field issue
- Footnotes in custom fields
- Custom metabox not working
- Run Function if Order Meta Exists – WooCommerce
- Help with this custom field conditional if no field is set display nothing
- Custom wpdb query – how to sort post by another table meta_count
- How to change permalink on headlines in rss feeds?
- if statement display content even though no data
- How to get custom image field of specific post id
- Create a new custom field for all posts based on current custom field
- Listing the most popular 8 city (custom fields) as used in posts
- Display latest post depending on Meta Box content
- How to pass custom field value to shortcode?
- Display Meta Data with HTML?
- Automatic linking terms
- custom comment_form fields not displaying
- Custom field to array?
- Fallback for empty custom fields
- WP_Query () using taxonomy, custom post types
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Adding extra fields to front end signup form
- How to change order of posts in admin
- How to store meta field values
- How to sort by custom field value?
- Display custom field value as a mailto: link
- Meta Box Plugin Cloned Fields – Multiple Foreach values
- Ordering by ‘Title’ OR ‘Custom Field’
- How can I add/update post meta in a admin menu page?
- Custom Jquery in admin breaks media-upload script
- Custom product fields in wp e-Commerce plugin [closed]
- wp_editor on custom meta textarea field – images and html fails
- pull all posts’ meta key values from current category only
- Show array of meta_value in Edit Post Coloum
- Custom Query Fields – Altering Meta Value
- Is it possible to use get_post_meta() to control HTML?
- Editing custom fields for comments
- using custom fields on content.php file of my theme