Uploads end up in subdirectory root

Hi there,

I uploaded a website to a subdirectory, and in that subdirectory in added the cockpit directory and renamed it to cockpitadmin. So the structure is:
https://thedomain.com/website/ (the website’s files)
https://thedomain.com/website/cockpitadmin/ (cockpit’s files)

When I upload images to Finder, some - not all - end up in the “root” of /website/
It seems it mostly happens when drag-and-dropping images.

Questions:

  • is it OK to rename the cockpit folder?
  • should I specify the uploads directory in a config file?
  • @raffaelj mentioned several times not to use Finder but only Assets; can this be related?
  • has anyone in the forum experienced a similar issue?

Thanks!

It seems like the culprit is indeed the Finder. All finder files end up in the “root” of /website/, so in the parent directory of cockpit. Where do I define the upload path of finder?
I already tried:

    # define additional groups
    'groups' => [
        'admin' => [
            '$vars' => [
                'finder.path' => '/storage/upload'
            ],
        ]
    ],

But this shows a blank page in Settings.

Hello tokant,

you should be able, to navigate to the correct folder before uploading files via finder. Than they should be in the correct place.

In most cases, this shouldn’t be a problem. If you used the wysiwyg field with images/assets, there might be wrong path names, that have to be replaced after renaming the folder.

This is not necessary.

That’s a general problem. I think, the finder is too powerful for most use cases (It’s possible to create or change php files…). I like to use multiple user groups. The manager group can do everything, except changing the config file and using the finder.

If you use a different user than the admin, you can define finder.path to /storage/uploads or leave that one empty, because the uploads folder is the default for non-admins with finder access.

config.php:

    # define additional groups
    'groups' => [
        'manager' => [
            'cockpit' => [
                'backend' => true,
                'finder' => true,
            ],
            '$vars' => [
                'finder.path' => '/storage/upload'
            ],
        ]
    ],

The problem with changing finder.path for admins is an internal logic. Files are called with a media api call, that uses the finder.path variable:

It is expected, that super admins have access to all areas including the config folder, so limiting that path for admins leads to wrong results when the media controller checks, if a file exists.

1 Like

@raffaelj Perfect answer! Thank you so much for taking your time to respond so thoroughly. Much appreciated!

I’m glad, I was able to help.