0

I have one webform which contain the private file field.

As admin user: i can upload the file and submit the form.

As anonymous user: i can upload the file but while saving the form, i am getting 'file field is required'

Uploaded file '/system/files/webform/abc.jpg' present at '/sites/default/files/private/webform'.

As Anonymous user: i can access file using '/sites/default/files/private/webform/abc.jpg' but get access denied using '/system/files/webform/abc.jpg' url.

Additional Info:

File Setting:

Private Path : 'sites/default/files/private'

Public Path : 'sites/default/files'

Drupal 7.64

Webform : 7.x-4.18

0

First and foremost, you've got an error in how you set up your private files path. It should be located outside of your web root, not as a subfolder of your public files. The way it is now, your private files are actually public. That is the reason why you can acces the file at '/sites/default/files/private/webform/abc.jpg', you shouldn't be able to do that.

Now as to why you get an error uploading it is probably an issue with how your permissions are configured for private files. The anonymous user can upload to the private files, but does not have sufficient permissions to access the uploaded file.

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.