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

Hello
I’m having similar issues setting up my private file system path. I have changed my file path on settings.php but still no luck. Any suggestions or help.

Check that folder exist , if exist check file permission.

The file exist and the permission is set at 770, I hope its the right level

Who is owner for that folder.ls -lh

The folder is set for private and group but no world. If you don’t mind can you check it out and see what I’m doing wrong. I have been working on it all day and still not working for me.

Okay sir. Can you share that credentials privately?

now that site is opening.

that is apache server DocumentRoot problem in shared hosting. Because, in shared hosting we can’t change main domain DocumentRoot it’s pointing to public_html folder.So, we adjusted in .htaccess file in public_html folder pointing to /farmOS/web/. tank you. Already described in this topic https://farmos.discourse.group/t/install-and-update-farmos-on-shared-hosting/2215

here, you should set private file path during installation time. (just remove # before $settings['file_private_path'] = 'sites/default/private/files this line).

this is not editable via cpanel filemanager. so, i just edited using cpanel terminal(because drupal generated private: folder is empty). now its worked. check here. thank you.