Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi!
Maybe I am just blind but is there a way to specify the upload directory somewhere in the privat directory of D7 in case someone is asked to upload some private data? If there is no way to do this right now, whould this be a feature for the future?
Thanks a lot for this great module!
Kind Regards
Marcus
Comments
Comment #1
quicksketchNo, there is not. See #1079226: Support private file fields in Drupal 7.
Comment #2
quicksketchI should be more clear. There's no way to make *a single file component* private and have the rest be public. Webform will always save files into the default file scheme. So if you have the default scheme set to private, Webform will use that.
Comment #3
shinmaikeru CreditAttribution: shinmaikeru commentedYour comment "if you have the default scheme set to private, Webform will use that." sounds like what I am looking for, but I don't know how to achieve this.
I am trying to create a webform in latest D7 through which conference applications upload CVs, recommendation letters, etc. to compete for places in a funded workshop.
Applicants will access the site as anonymous users. No accounts.
Once submitted, the applicant does not need access to form data or uploads.
I created a role that has access only to its own webform results, and I created a user in that role, so I think that is okay, but I don't know how to protect the uploaded files.
I want all the uploads for that webform to be accessible only to the site administrator and the Author of the webform.
Is what you are talking about a solution? And if so, please point me to some documentation on how to set that. I cannot find it.
Thank you.
Comment #4
quicksketchThe default file scheme is for *your entire site*, so just be aware that you'll be affecting a lot more than just Webform with the change. The default option is available under admin/config/media/file-system, "Private local files served by Drupal".
Comment #5
quicksketchThere's now a patch in #289919: Provide AJAX-based file uploads/Progress Bar for uploads that adds full private file support in Drupal 7. You can even mix private and public file components within the same form.
Comment #6
Andrés Chandía CreditAttribution: Andrés Chandía commentedAnd how or where I tell webform to change the webform directory from ...files/webform to ...files/private/webform
I've been searching around because I think I see at some point of the configuration process this setting but I can not find it again.....
Thanks
Comment #7
Andrés Chandía CreditAttribution: Andrés Chandía commentedNo worries, I have found it in the form inside of the file field options
Upload destination
Private file storage has significantly more overhead than public files, but restricts file access to users who can view submissions.
Comment #8
Andrés Chandía CreditAttribution: Andrés Chandía commentedSorry, I'm reopening because it save the files at the public directory anyway, even though I have check the option of private file, so I guess there is a setting to change somewhere..... where?
Comment #9
babusaheb.vikas CreditAttribution: babusaheb.vikas commentedYou need to follow these step:
#1 You need to set "Private file system path" from admin/config/media/file-system as "sites/default/files/private".
#2 Configure your field "public" to "private" during creating field in webform.
Comment #10
Andrés Chandía CreditAttribution: Andrés Chandía commentedIt didn't work for me:
#1: Done.
#2 : "Private fields are shown only to users with results access." : Done
#3: Permissions: "Access own webform results " and "Access own webform submissions" Done.
But when going to the form with an authenticated user the field I have marked as Privete is not shown, I can not give to authenticated user permission to "Access all webform results", is not safe.
I cleaned the cache just in case, but nothing...
Comment #11
DanChadwick CreditAttribution: DanChadwick commentedRe #10. You are confusing private webform components with the file storage scheme of public versus private.
1) Configure yoru private file page as directed. You can also configure a public path, if you want that too.
2) In each webform file component, you can pick which scheme (public or private), assuming you have more than one defined. If you only have one (e.g. public), then there is no choice and the option is not displayed.
3) Open a different issue if you are still having trouble. However, with the information you've given, I think you will need to debug this yourself in your development environment. I suspect you have some sort of configuration issue. If you only have the private file system defined, then it would be impossible to store public files.
As a general rule, don't reopen an old issue unless you know there is a problem with the patches or solution to that issue. Your issue is unrelated to ADDING private files to webform. You are having trouble using the existing functionality.
Good luck.
Comment #12
Andrés Chandía CreditAttribution: Andrés Chandía commentedThanks a lot, I don't know how, but it is magically working now...
Thanks anyway!