[Forminator] Changing upload location

I’d like to change the location of uploads from a Forminator form to a different directory so I can protect those files from outside access. Can you help me with that?

  • Panos
    • SLS

    Hi Bj ,

    We had a few requests in the past regarding switching that folder so we have a few snippets that change the upload path depending on the request each time. This one is the simplest one:

    https://gist.github.com/wpmudev-sls/46d776223d9d54c732fd409b2e78c8a9
    it sets the upload path to wp-content/forminator (outside the uploads folder). You can change that path in this line :
    private $path_part = '/forminator/';

    There are a few more complex requests like :

    https://gist.github.com/wpmudev-sls/a22b51fa5448c2d8f1eea4f49dd5e981
    This changes the upload folder to uploads/forminator/member_name

    or

    https://gist.github.com/wpmudev-sls/639f2b6d711016e74ffa86d3a8e3c0d3
    which sets the path to wp-content/forminator/form_id/YYYY/MM/DD/submission_id

    Depending on what you need we can modify one of those.

    You can try them by downloading the zip, unzip and you should get a folder. In the folder there should be a php file. You can open and edit this file if you need (eg change the file a bit). Once you got the php file done you can upload it to your wp-content/mu-plugins folder. In case the mu-plugins folder doesn’t exist you can create it.

    A few notes:
    1. I would strongly suggest to first test this in a staging/testing/local site before moving to production
    2. Please test only one of these php files each time. In order to test a second one remove the one you already tested from your mu-plugin folder. This is because all of those will try and filter the same thing so basically one will try to cancel the other and only one will prevail, which might not be the one you want to test.

    Kind regards!