• Resolved schumiholic

    (@schumiholic)


    Hi! Is it possible to change the folder location where the uploaded files are saved by default? I would like to have a different folder for uploaded files for each form. How can I do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Tahmid ul Karim

    (@tahmidulkarim)

    Hi @schumiholic,

    There isn’t any direct option to change the folder location where the uploaded files are saved but you can change that using custom codes..

    If you want to change the file upload location then you can do that using the filter hook –

    add_filter('fluentform/file_upload_options', function ($locations){
    
       // Do your stuff here
    }, 10, 1);

    Thank you!

    Thread Starter schumiholic

    (@schumiholic)

    Where do I add this code, in the functions.php file? And how do I add the location in the format ‘example.com/upload-folder’?

    Plugin Author Lukman Nakib

    (@pyrobd)

    Thread Starter schumiholic

    (@schumiholic)

    I’ve been trying to adapt the code to my needs, but something is not working right. What I am trying to achieve is for a specific form (id 7 in this case), the images to upload in a specific folder (competitions in this case). The if function is not working. Can you please tell me what I need to modify?

    add_filter('fluentform/default_upload_path', function ($path, $form) {
        $form_id = $form->id;
    
        if ($form_id == 7) {
            return wp_upload_dir()['basedir'] . '/competitions';
        }
    
        return $path;
    }, 10, 2);
    Plugin Contributor Md Delwar

    (@hrdelwar)

    Hello Schumiholic, sorry for delay. Somehow $form->id was null when uploading file or image, we will fix it our latter release. If possible just make it’s simple, forget about form id condition and make sure File Upload Location is set as “Fluent Forms Default”. If it’s mandatory to check ($form_id == 7) you can create a support ticket here to get fixed version.

    add_filter('fluentform/default_upload_path', function($path, $form) {
        return wp_upload_dir()['basedir'] . '/competitions';
    }, 10, 2);
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Change the upload folder path’ is closed to new replies.