Score:0

Upload directory with no prefix (://) was not found for file uploads

de flag

I am not able to get file uploads of any type to work on my Drupal instance when I attempt to add media using the built in form. When I upload an image file, I get:

enter image description here

And looking at the log messages in Drupal I see:

The upload directory ://2022-05 for the file field field_media_image_private could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.

I do not understand where the path :// comes from. I would have expected it to be something like public:// or private:// but not just ://.

A few things I tried with no success (for test purposes):

  • Setting relative instead of absolute paths for files and private folders in settings.php.
  • Setting 777 permissions on the files and private folders.
  • Disabling every module except core and rebuilding all caches.

What else could be the source of this issue? What else can I check?

Jaypan avatar
de flag
It's supposed to be public:// or private. Some module somewhere has a bug. You'll need to track down which module.
miststudent2011 avatar
fr flag
Have you defined `$settings['file_public_path']` value in settings.php
Anton avatar
de flag
@miststudent2011 I did, it's just set to 'files'
Anton avatar
de flag
@Jaypan I uninstalled every single module except core and this issue still happens.
miststudent2011 avatar
fr flag
Try setting it as `$settings['file_public_path'] = 'sites/default/files';`
Anton avatar
de flag
@miststudent2011 I tried that but it didn't change anything.
Score:0
id flag

In your question you said you made sure the private directory is relative and not absolute. The private files directory must be specified as absolute. Below is the documentation for file_private_path, from default.settings.php (emphasis, mine).

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.

Anton avatar
de flag
I just meant that this is something I tried, based on other answers on this website to similar issues. I originally had it set to an absolute path. Neither absolute nor relative works in my case unfortunately.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.