• Resolved skafte

    (@skafte)


    Hi,

    Is it possible somehow to define where certain attachments are stored? For example, I have two forms where visitors can upload attachments and I’d like to make sure that the attachments end up in different folders on my server depending on which form they were uploaded through. Hope that makes sense!

    Many thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author jasongreen

    (@jasongreen)

    Hi Skafte

    Yes you can. There are two values you need to override using WordPress filters.

    Below are a quick examples, you will need to replace the applicable values for your site.

    function custom_wpcf7s_dir($upload_dir = ''){
        return '/var/www/...';
    }
    add_filter('wpcf7s_dir', 'custom_wpcf7s_dir');
    
    function custom_wpcf7s_url(){
        return 'https://www.example.com/uploads';
    }
    add_filter('wpcf7s_url', 'custom_wpcf7s_url');
    Thread Starter skafte

    (@skafte)

    Hi @jasongreen,

    Many thanks for this!

    So, how do I determine which contact form uploads to which folder? From what I can read from this code snippet it looks to me like it will determine where attachments are uploaded to for all submissions – is that right?

    I wonder if more control over where attachments are being uploaded to, on a form to form basis, would be a really useful new feature to the plugin?

    Thanks again for your help with this!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Is it possible to define upload folders for attachments depending on form?’ is closed to new replies.