Question

So, i’m trying to find out a way to use two separate upload folders, being the default one wp-content/uploads for general media uploads, and another one say wp-content/custom for one specific type of attachments (PDF files attached to one specific post_type).

It is important to keep’em separated both for organization and data security as the PDF files will hold somewhat sensitive data that should only be acessible by two custom user roles, while general media is, well, general.

I’m a little embarrassed to show you the code i got working, because it’s lousy, but here it goes:

    function custom_post_type_metabox_save_function($post_id) { global$post;

// Verify auto-save, nonces, permissions and so on then:

update_post_meta($post_id, "meta_key1",$_POST["value1"]);
update_post_meta($post_id, "meta_key2",$_POST["value2"]);

// this is where it gets uply. I change the 'upload_path' to my desired one for this post type

// then upload the file to it
wp_upload_bits($_FILES["pdfexame"]["name"], null, file_get_contents($_FILES["pdfexame"]["tmp_name"]));

// and then change it back to default... :\$