# Uploads end up in subdirectory root

**URL:** <https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146>\
**Category:** Uncategorized\
**Created:** [January 8, 2020, 11:47am UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146 "2020-01-08T11:47:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![tokant](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tokant](https://discourse.getcockpit.com/u/tokant)\
**Post date:** [January 8, 2020, 11:47am UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146/1 "2020-01-08T11:47:27Z")

</div>

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/](https://thedomain.com/website/) (the website’s files)  
[https://thedomain.com/website/cockpitadmin/](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!

---

<div class="post-metadata">

**Author:** ![tokant](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tokant](https://discourse.getcockpit.com/u/tokant)\
**Post date:** [January 8, 2020, 1:26pm UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146/2 "2020-01-08T13:26:46Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [January 10, 2020, 1:49pm UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146/3 "2020-01-10T13:49:09Z")

</div>

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.

> [@tokant](#):
>
> is it OK to rename the cockpit folder?

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.

> [@tokant](#):
>
> should I specify the uploads directory in a config file?

This is not necessary.

> [@tokant](#):
>
> raffaelj mentioned several times not to use Finder but only Assets

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:**

```auto
    # 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:

> <https://github.com/agentejo/cockpit/blob/next/modules/Cockpit/Controller/Media.php#L20>

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.

---

<div class="post-metadata">

**Author:** ![tokant](https://avatars.discourse-cdn.com/v4/letter/t/90db22/32.png) [@tokant](https://discourse.getcockpit.com/u/tokant)\
**Post date:** [January 10, 2020, 3:31pm UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146/4 "2020-01-10T15:31:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![raffaelj](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.getcockpit.com/raffaelj/32/331_2.png) [@raffaelj](https://discourse.getcockpit.com/u/raffaelj)\
**Post date:** [January 10, 2020, 3:48pm UTC](https://discourse.getcockpit.com/t/uploads-end-up-in-subdirectory-root/1146/5 "2020-01-10T15:48:59Z")

</div>

I’m glad, I was able to help.
