file-field_type - default upload folder
Created 7 years ago by huglester

Hello,

is there a way to set up default upload folder via config? For some modules, I would like to auto-create folders on install (for example), and if user picks to upload - it would automatically upload to folder like "cookiesforsale"

Thank you

ryanthompson  —  7 years ago

If you define only 1 folder it will skip the selection of it - so in your case I think you could use a builder override to override the fields config on runtime.

ExampleFormFields
{
    public function (ExampleFormBuilder $builder) {
        $builder->setFields([
            '*',
            'upload_field' => [
                 'config' => [
                    'folders' => 'you_custom_folder'
                 ]
            ]
        ]);
    }
}

Then you could add any custom logic to this you wanted - like defining the module's folder.