Organize File Uploads by Custom Field

I have a ‘new projects’ form that users can fill out and use to upload files related to that project. The form also assigns a unique ‘project number’ to each project. I would like the uploaded files to be organized according to that ‘project number.’ I found your example on how to ‘organize by post name’ and ‘organize by user name’ and I tried to modify that to work for my situation, but I can’t get it to work.

Following is the code for ‘organize by post name:’

add_filter('frm_upload_folder', 'frm_custom_upload');
function frm_custom_upload($folder){
    global $post;
    $folder = 'formidable/'.$post->post_name;
    return $folder;
}
What would I need to change to 'organize by project number?'
Thanks in advance.

You can try changing $post->post_name to $_POST['item_meta'][25] (replace 25 with the id of the field)

This is untested so you will need to troubleshoot on your own.

Works perfect. You are so wonderful...Thank you!

Topic closed.