Share Salesforce Files with Community User
Files uploaded via this related list will only be visible to internal users, and this field is not editable.
One thing you can do is post the file to the record via the Chatter publisher, and specify the visibility in your post. This would give the attached file the same visibility as the post.
Another option is to write a trigger and edit the Visibility field of the ContentDocumentLink that is created when the file is uploaded. Although you might want this to be context aware so that you don’t do this whenever any file is created (and also requires some technical knowledge).
Replace YOUROBJECTAPI with your object api name and it will share only files uploaded on a that object: