Ahh I figured it out. After echoing and print_r every single thing I could I figured out that this line:
$uploaded_file = wp_upload_bits($_FILES[$pdf_field['name']], null, file_get_contents($_FILES[$pdf_field['tmp_name']]));
Needed to be changed to this:
$uploaded_file = wp_upload_bits($pdf['name'], null, file_get_contents($pdf['tmp_name']));
The original problem I had in the first place was not being able to pass my $_FILE array directly into functions (I’m assuming because I was in a foreach loop) to see if the values were set, etc… So I put them in the variable $pdf = $_FILES[$pdf_field['name']];
.
I should have been using that variable to access my array instead of the $_FILES directly.
I was able to successfully load a PDF to my server.
Thanks!
Related Posts:
- Add metabox with media uploader in a custom post type [duplicate]
- Remove tabs from media uploader for a CPT
- wp is not defined error using wp.media to create a custom image uploader
- window.send_to_editor and jQuery .attr() conflicts with multiple custom upload image meta boxes
- Duplicate Custom Header Functionality into the post edit screen
- WordPress 3.5 Media Uploader – Only allow 1 upload and certain file types
- How to Create an Image Upload Box for Custom Posts?
- Checking if $_FILE isset for an array of file upload metaboxes
- Create a custom post type for a photo post
- Multiple Custom Metabox Help
- How can I add a column/s to wp_posts table?
- Find callback function for custom taxonomy metabox
- Add special meta box to custom post type
- Custom field values get deleted
- Priority of Meta Box for Custom Post Type
- Using ‘strtotime’ function to convert a custom-meta-box to a date-stamp
- How to Change the Title of a Meta Box on a Specified Custom Post Type? [duplicate]
- How to save the checked boxes?
- Adding Custom Metaboxes to Custom Pages
- add_meta_box: Datepicker like the one for postdate?
- Save or update data when custom post published
- Custom metabox translation
- Custom Post Type Meta Boxes
- Formatting custom meta box date from YYYY/MM/DD to a more readable alternative
- Using WPAlchemy metabox values in another metabox
- Dynamically add / duplicate custom meta in custom post types
- Custom Post Type Metabox – Not Saving
- Cannot attach media when capabilities added to custom post type
- How can I create a custom meta box to add an mp4 video to a page?
- List of Posts in a Custom Field
- Pull a post based on a meta value in a custom post type
- Change meta box when the page’s template is changed
- Cannot save Checkbox meta box value from a Custom Post Type
- Undefined Variable – Custom Post Type Meta
- Display users uploaded files as posts
- Add Standard Page Attributes Metabox for Page Parent
- Add a button or image button that calls wp functions in the wp-admin
- Custom date changer post_date => future – missed schedule error
- Found 2 elements with non-unique id (#_ajax_nonce) and (#_wpnonce)
- Metabox not show in categories custom post type cmb2
- Repeatable Fields Metabox with Textarea (or wp_editor)
- How to use TinyMCE Editor for one of my custom post meta field?
- Display correctly using metabox.io
- pre_get_posts for custom page builder meta box
- How to make custom taxonomy into drop down select in a custom metabox
- Translating custom post type metaboxes [closed]
- How to Add multiple instance of meta box to custom post type
- Using POST method in meta box, no results
- Global custom meta box
- Add additional field to custom post_type
- Add a custom meta box for client to order CPT posts how they want
- Save Multiple Metabox values
- Use remove_meta_box conditionally on custom post type
- Create metaboxes based on custom post type
- How to Echo Metadata Value in Currency Format
- Issue on Working with Metabox – Checkbox to enable Sale Items
- Problem with $post_id object’s property
- How To Display A List Of CPT Posts In A Meta Box On Menus Page?
- populate array with posts
- How to make a meta box?
- Forms and WordPress Nonce
- Why do I have to press the “Update” button twice to save my meta box values?
- Prevent custom post type from showing up in custom menus
- CMB2 metabox create select with list of post from CPT
- Creating alternate meta box context locations
- Meta box data is saved but NOT displayed in the meta box text field. Why?
- Custom meta box in custom post type not working
- WP_Meta_Query object with conditionals
- Query Custom Posts – Add To Selection
- I can’t connect my custom jquery to wp admin
- Saving meta box data?
- Metabox does not show in custom post type
- One Custom Post Type two different Templates
- Create a custom post type based on ‘Post’
- How do you make relational post types in WordPress? [duplicate]
- Include a metabox in the ‘home’ screen of a custom post type? If not, then the dashboard page?
- Placing Admin Post Metaboxes in Tabs
- Wp Meta Query does not work while simple Query Works
- How to get custom post type with dynamic ID
- Custom metabox with image gallery upload that won’t attach images to post
- Problem with multi checkboxes value in metabox?
- Wp Query sort order from custom MetaBox
- How to retrieve custom post type permalink in another cpt?
- Custom Upload Directory for Custom Post Types
- do action inside a class is not working
- How to add a custom meta box below publish box in CPT that is like publish meta box and can contains html?
- Search form to find custom meta box generated data
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Custom metabox value not saving
- Yearly Archive from a custom date metabox (Event Start Date)
- Need to build custom metabox select prev posts by category
- Customized featured image doesn’t refresh in post admin metabox after upload/insert
- Saving custom metabox data with a twist
- loop through custom post-type with two meta_keys
- Allow authors to create article image
- Custom Post Type + Custom Meta Query Not Showing 2012 Posts
- CPT Template Option to Top
- Use a Variable in update_post_meta as the $meta_key
- How to consume external API from WordPress post editor and display the response data in the custom field?