On my Drupal 8 site, I want to use the Webform module with file upload. It works, if I use public file space (within the web root directory), but fails on private file space (outside the web root directory, strongly recommended for security reasons).

Drupal log file contains the following error messag.

The upload directory private://webform/testform/sid could not be created or is not accessible

If I create the needed subdirectories within private (e.g. webform/testform/sid ) directly using the terminal, the upload itself works, but the submission fails, because the webform module was not able to move the file to a newly created submission directory.

On my local development machine all works fine, but on the server it fails. I think it is more a server-configuration issue.

Other modules are able to work with the private files directory. The access-rights are 755 as recommended. Trying to temporary set the file permissions to 777 doesn't fix it. Trying to add the private files path to the open_basedir directive doesn't fix it.

Normal file upload works on this machine; therefore file_uploads and other PHP directives are correctly configured. The error is not directly connected to file uploading, but with creating directories in the private filespace.

What can I try next to get it working?

| improve this question | | | | |
  • Have you tried setting the ownership of the private directory to your webserver user? For example chmod -R www-data:www-data private – Ismail Cherri Mar 9 '19 at 20:39
  • Yes, I have looked at this point. It is a Plesk-Installation with PHP-FPM. The Webserver runs as the FTP-User and not as www-data. The ownership and access-rights are the same like almost other files and directories within web root. The Webserver is able to write files there, if the directory to write in exist. He ist not able to create the directories in this location. I don't know any difference between files and directory creating at unix system level. Therefore this case ist mysterious to me. – James Butler Mar 10 '19 at 8:08
  • This is definitely a server setup issue and not related to webforms or Drupal. I couldn't reproduce your error on my server with proper permissions – Ismail Cherri Mar 10 '19 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.