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
- Custom post meta field effect on the performance on the post
- Difference between meta keys with _ and without _ [duplicate]
- Add custom objects/entities to WordPress
- Is there a way to do multiple ordering on a multiple meta_query?
- Plugins won’t recognize my plugin’s hidden custom fields
- Store JSON in a custom field
- Best way to add custom / magic / flutter fields into RSS feed
- Setting orderby to a custom field using pre_get_posts
- How to get multiple checkboxes in one meta field
- Adding Custom Fields to Search
- How to Display Custom Meta Box only on Specific Page IDs
- Get custom field label
- Custom Field Suite A little problem
- How make a custom search on backend in WordPress without plugin?
- Multiple images with Media Uploader on front-end
- get_posts that haven’t been assigned a specific custom field
- frontend image post uploader
- Displaying page image in the footer automatically
- Hide custom column in admin template screen (Elementor) [closed]
- ORDER BY custom field value out of where clause
- How can i retrive a text from a custom field
- ACF: How to get users with a ACF flexible content subfield with a specific value AND layout?
- Is it possible to populate a custom field with content from a page
- Save all custom field data into one “master” custom field
- How to put forward a blog post
- Plugin or shortcode for ISBN number?
- Display latest post depending on Meta Box content
- WP-eComerce Advance Meta Tag data in descending order [closed]
- Custom fields won’t update
- Replacing custom field with shortcode
- WPAlchemy issue when using 2 select menus with the same values inside a repeating group
- Is the use of many custom field not good for server?
- Very large list of options for BuddyPress profile fields
- Change Order of Sections Using Custom Fields
- How to add content with a filter when there’s no content in the editor
- Order a query by meta_value and then by post_date
- custom field functionality
- WordPress archives by custom field and date
- Decouple page name from page title
- Custom Field add markup to line breaks
- Use Metabox to enter Post Title
- Include custom fields into the content of a regular page
- Bypassing a Form Options
- i want to send email on custom post field (job_status == 2) but it is not working
- How to create a searchable database with a single-field search box at the front end? [closed]