0

I am trying to set up the private file system for drupal 8. I have created a private folder /home/user/public_html/private_files with permissions set to 777

in settings.php i uncommented the $settings['file_private_path']= '/home/[USERNAME]/public_html/private_files';

the .htaccess file was created.

the status report page gives: File system Writable (private download method)

When i try to upload a file with either the webform file field or a drupal file field i get the error message: File could not be uploaded.

In the error log i get: The upload directory private://webform/XXXX/sid for the file field 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.

Can anyone help me with this

1

Your path must exist outside of your webroot directory and be an absolute path, for example: /var/www/private )

Also check PHP configuration

  • file_uploads = On must be set to "On"
  • upload_max_filesize = 24M can't be larger than post_max_size
  • max_input_time = 300 small values may cause timeouts for large file uploads
  • memory_limit = 64M small values may cause out of memory errors for large file uploads
  • max_execution_time = 180 small values may cause timeouts for large file uploads
  • post_max_size = 24M limits the size of input submitted to the website (including attached files)

Information is taken from here.

  • is it correct that '/home/USER/www/' should be the webroot directory. if so, i have now tried '/home/USER/private/' as private directory, this also gives the same error. i have checked the PHP configuration and that seems to be the same. – Falco Hulzebos Oct 12 '17 at 14:48
  • For example run command in sh: sudo chmod -R 777 /home/USER/www/ – Ruslan Telyak Oct 12 '17 at 14:57
  • /home/USER/www/ now also has 777 permission, the site still gives the same error when i try to upload a file. – Falco Hulzebos Oct 14 '17 at 7:48
0

I ran into the same problem. I set up the private upload directory like this:

$settings['file_private_path'] = $app_root . '/../private';

That way the private folder was above the web root. Although Drupal could access it Webform couldn't. I tried different path levels and ended up with the directory

$settings['file_private_path'] = 'sites/default/private';

which is working - although this is not the safest set up.

Your Answer

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

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