The file could not be uploaded because the destination "private://farm/asset/2023-01" is invalid

Hi,
I’m new to Drupal and FarmOS.
Recently I installed FarmOS with CloudPanel (Nginx based) and everything seems to be working fine. However, when I try to upload a file, it always gives me this error.

" The file could not be uploaded because the destination “private://farm/asset/2023-01 " is invalid.”

I installed tarball from GitHub, and I followed other forum issues and did no help.
Here are some tech data, so it might help to pinpoint the issue.

Hosting Directory: /home/farm-os/htdocs/sites-name/web
There was no private/files folder in sites/default, so I created it manually
Later
I checked the configuration files and added the following settings.

/**
 * Private file path:
 *
 * A local file system path where private files will be stored. This directory
 * must be absolute, outside of the Drupal installation directory and not
 * accessible over the web.
 *
 * Note: Caches need to be cleared when this value is changed to make the
 * private:// stream wrapper available to the system.
 *
 * See https://www.drupal.org/documentation/modules/file for more information
 * about securing private files.
 */
 $settings['file_private_path'] = 'sites/default/private/files';

/**

I found the same issue and performed Nginx and server reboot, and no luck.
Requesting assistance.

1 Like

Hi @drlostphoenix welcome to the farmOS community! :slight_smile:

$settings['file_private_path'] = 'sites/default/private/files';

I think this needs to be an absolute path. I don’t know if it works when it’s relative.

That directory also needs to be writable by Apache/Nginx.

I tried the absolute path as well, but that didn’t help and saw other members using such a path and mentioned that that worked for them, and that’s why I used it.

Directory got full access by Nginx and have 755 permission

2 Likes

I think you need to clear the cache after updating settings.php

1 Like

I tried from a different browser and pc and had the same issue.
Do you mean site-based clear cache? How can I do that?

and here is the File System Configuration

2 Likes

Yes site cache, ‘drush cr’ from command line, there is a UI option somewhere as well.

Maybe /admin/config/development/performance

1 Like

Omg, that actually fixed the issue!
Thanks a lot.

3 Likes

Great!

We need to add this to the docs…

2 Likes

Yes, was just thinking the same. Was it mentioned by someone in a meeting recently too?

I suppose by right the settings.php file should be configured before installing the site?

1 Like

Indeed it was.

It can be (that’s what I do personally), but I think it’s a bit simpler (from a new user documentation perspective) to let Drupal create the settings.php file during installation and then add this line + cache clear after. Otherwise the instructions involve a lot more manual editing of settings.php, which Drupal’s install.php handles with a nice UI. :slight_smile:

2 Likes

Think I joined mid conversation but got the jist.

Ah yeah, that would make sense alright.

1 Like

Was going to volunteer this, but I see @lordeddi has it in hand.

1 Like