• Resolved 50M

    (@50m)


    What am I missing here?

    I added the following code to change the upload path/folder for form ID 12. When I test the form by uploading a file, the file name shows up in the entries list and is linked to the right file path, however the file is not actually there, i.e. it’s not there when looking via FTP client and clicking the link to the file returns a 404. It’s like it’s partially working, but writing the file to the location fails. Here’s the code I added to the functions.php file:

    add_filter( ‘frm_upload_folder’, ‘frm_custom_upload’, 10, 2 );
    function frm_custom_upload( $folder, $atts ) {
    if ( $atts[‘form_id’] == 12 ) { // change to your form id
    $folder = $folder . ‘../wp-content/uploads/product_images/’;
    }
    return $folder;
    }

Viewing 6 replies - 1 through 6 (of 6 total)
  • James Pond

    (@jamesponddotco)

    Hi,

    The correct code should look like this:

    add_filter( ‘frm_upload_folder’, ‘frm_custom_upload’, 10, 2 );
    function frm_custom_upload( $folder, $atts ) {
      if ( $atts[‘form_id’] == 12 ) { // change to your form id
        $folder = $folder . ‘/wp-content/uploads/product_images/’;
      }
      return $folder;
    }

    Just keep in mind that the hook ‘frm_upload_folder’ is used to organise files inside ‘/wp-content/uploads/formidable/’, not to allow you to upload files outside of that directory.

    So using the path and form ID you used, the directory structure would look like this in the end: ‘/wp-content/uploads/formidable/12/wp-content/uploads/product_images/’

    You can see more information and examples within our documentation:
    https://formidableforms.com/knowledgebase/frm_upload_folder/

    Please let us know if you have any additional questions.

    Thread Starter 50M

    (@50m)

    Thanks.

    Is there any way to force it to upload to the folder I specified (../wp-content/uploads/product_images/), which is the product_images folder I have located in the uploads folder?

    Thread Starter 50M

    (@50m)

    I don’t need or want the images to show up in the media library either, if that helps.

    Plugin Author Steve Wells

    (@srwells)

    Hi there. Can you please create a ticket from our support page? The WordPress moderators don’t like us to provide support for our pro version on www.remarpro.com.

    A new ticket can be created here: https://formidableforms.com/new-topic/

    Thread Starter 50M

    (@50m)

    Okay, I just opened a ticket at the link you provided. Thank you!

    Plugin Author Steve Wells

    (@srwells)

    Perfect. We’ll look for your question there. Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Upload Path Modification’ is closed to new replies.