0

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?

6
  • It's supposed to be public:// or private. Some module somewhere has a bug. You'll need to track down which module.
    – Jaypan
    May 9, 2022 at 3:44
  • Have you defined $settings['file_public_path'] value in settings.php May 9, 2022 at 3:56
  • @miststudent2011 I did, it's just set to 'files'
    – Anton
    May 9, 2022 at 13:39
  • @Jaypan I uninstalled every single module except core and this issue still happens.
    – Anton
    May 9, 2022 at 14:00
  • Try setting it as $settings['file_public_path'] = 'sites/default/files'; May 9, 2022 at 14:19

1 Answer 1

0

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.

1
  • 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.
    – Anton
    May 9, 2022 at 13:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.