Invalid file type when using wp_upload_bits to upload PDF to a custom post type

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!