The Community forums are being phased out in favor of a new Slack group.
Add your email address below to get an invitation to join the community slack group

Slack Signup
Newsletter Optin
Help Desk

File Upload Folder


This Discussion is public


Hi All,

I came across a problem in the last few days and i thought i'd share the solution with you all.

The Problem:

I wanted to change the folder that files will be uploaded to when using the File Upload field to an existing folder somewhere else on my server and NOT as a sub-directory of the /uploads/formidable/ folder. To further complicate matters i already have a folder per client set up (actually created by the WP-Client Plugin) and i need the folder name to be looked up depending on who is logged in although you could remove this addition if you don't need it.

The Solution:

The solution is actually quite simple although it took me 2 days to get there as i'm not a coder by any sense. Add this to a new plugin or your themes functions.php file.

add_filter( 'frm_upload_folder', 'frm_custom_upload', 10, 2 );
    function frm_custom_upload( $folder, $atts ) {
    if ( $atts['form_id'] == 92 ) { // change to your form id
    global $current_user;
    $folder = '../uploads/wpclient/_file_sharing/' . $current_user->wpc_cf_client_file_cat;
    return $folder;

The folder file path requires ../ at the start to take you up a level from the default formidable folder and then from there you can define the folder you wish your files to be uploaded to.

I have a custom field in each user profile which contains the name of the users File Upload folder which is then looked up and added to the end of the file path using $current_user->wpc_cf_client_file_cat

So now when my client Mr Test logs in and uploads a file using this form it will be uploaded to his existing folder like this:

/public_html/wp-content/uploads/wpclient/_file_sharing/MrTest instead of the normal Formidable directory.

Hope that helps.

Thank you for sharing, Chris! Greatly appreciated.

Thank you very much for sharing. This is very useful for me.

Big thanks.  Very helpful.

Is it possible to let the user choose his folder with a dropdown menu ?

I tried this code but I always get the last value from the field.

add_filter( 'frm_upload_folder', 'frm_custom_upload', 10, 2 );
function frm_custom_upload( $folder, $atts ) {
if ( $atts['form_id'] == 1 ) { // change to your form id
$cat=FrmProEntriesController::get_field_value_shortcode(array('field_id' => 63, 'entry' => $entry_id));
$folder = '../uploads/' .$cat;
return $folder;

My field is for choosing a category like (music, movies, games, books)

If I select music the first time the file will be saved in a random folder.
If I select games the second time (even in another browser) my file will be saved in music folder.

Thank you

Discussion closed.