Score:0

Public Access to Private Files

gg flag

I have a content type that allows one or more file attachments and these are set as Private so that access to them can be controlled. A small percentage of these files I also want to be publicly accessible and would prefer not to upload them twice.

Is there a way to either:

  • create a link to a file that bypasses the access control?
  • give the option to choose public/private when the content is created?

I know I could create a 2nd field on the content type for public files, but that seems confusing, but may be my last resort strategy.

EDIT: To clarify (and sorry for the confusion) ... if I were to copy the URL to a file attached as a private file, it looks like:

https://mysite.com/system/files/path/filename.pdf

... and anyone who doesn't have access to the site cannot access it.

80% of the time for this content type, that's what I want to happen. The other 20%, I want that link to be accessible to anyone, logged into the site or not.

I want to create, for example, a view of this content type, filtered to this 20%, where a different URL is provided such that the file will be publicly available.

Thanks in advance for any advice!

id flag
What do you mean by "publicly accessible" in this question? Private system files are accessible if the field is shown on content that someone can access. Can you update the question to be explicit about what is desired?
Delford Chaffin avatar
gg flag
@cilefen - Edited. Hope that helps.
id flag
Does this answer your question? [Give access to private files to certain role?](https://drupal.stackexchange.com/questions/208639/give-access-to-private-files-to-certain-role)
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.