Uploading pdf to assest getting error: The file could not be uploaded because the destination "private://farm/asset/2022-04" is invalid

HI All.
short time user first time poster. I am still busy setting up all my assets. I want to upload pdf’s to certain assets. After creation of asset when attempting to upload the pdf I get the error: The file could not be uploaded because the destination " private://farm/asset/2022-04 " is invalid. I am pretty sure that error has something to do with the “private:” part as that looks like an invalid location name to me. Regrettably I only perused the forum after running into the issue, I have since updated to beta4, and also added the line to settings.php to set the private files location. thus far no luck. I am hosting on own docker with default locations for www and db. Any assistance will be appreciated. Thanks

Hi @trippi welcome to the farmOS forum!

The private filesystem configuration is something that has come up for others, so I would recommend searching the forum for other threads… but the summary is:

You need a directory inside the container at /opt/drupal/web/sites/default/private that is writable by the www-data user, and you need to add the following line to your settings.php file:

$settings[‘file_private_path’] = ‘/opt/drupal/web/sites/default/private/files’;

Here are a few threads:

Hey, thanks. I have, while waiting for a reply, continued looking through the forum and found a solution that worked. I did edit the settings.php adding the line " $settings[‘file_private_path’] = ‘/opt/drupal/web/sites/default/private/files’; " but removing the preceding slash from in front of opt/. Also a hard server reboot did nothing I had to clear the cache in admin - config - development - performance. I have only uploaded one pdf thus far but it seems to be working. Thanks again for the fast reply

I followed this post for the most part:

1 Like

Glad you got it working!

but removing the preceding slash from in front of opt/

Oh interesting! I’m not sure why that would work… but I do recall someone else saying that too (will need to check that other topic you linked to). :thinking:

Hello, Thanks for creating this nice web-app; i can now easily manage my farm using this.
In-fact i too had the same issue, despite doing all permission, creating directories etc, also following the slash removal before opt etc, it was not working, but as pointed by you to check the private path KML import in 2.x - #20 by mstenta here, i checked the same but it didn’t worked. Then I again checked the same and clicked on save button without changing anything, and viola, some directories were automatically created in that path and it started working, thought you may try this and if successful, add this info to the main installation guide

1 Like