By default, when you upload files from a record Related List, the file will be visible to all users who have access to the record. But, this can be changed by adding a field called File Privacy on Records in the Content Version page layout.
Once the file owner selects that checkbox, the file will not visible to other users, unless manually shared, but users with View All Data permission will be able to see those files.
Step to update the checkbox:
1. Upload the files from Related List, you can upload multiple files in one go
2. Open each file and click the arrow next to View File Details, then select Edit File Details
3. Change File Privacy on Records from Visible to Anyone with Record Access to Private on Records
- The file visibility does not roll up to users in the higher role hierarchy, so when the file owner sets this as Private on Records, the manager will not see the file, unless shared manually.
- The file visibility does not depend on the related record owner but depends on the file owner.
- If you query on ContentDocument object (prefix: 069), this is stored in SharingPrivacy field, P for Private on Records, and N for the default visible to anyone
However, if you click the Edit File Details link from the Files dropdown in a related list, you will not see that checkbox, as mentioned in this article. I have created an idea exchange to vote.