function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Jayanth G 3Jayanth G 3 

How to restrict the File Download link from allowing any user to download the file except for the file owner

Hello All,

I have a Community in which there are two LWC Buttons one button allows the user to upload a file while the other button allows the person to download a file.

Lets say Customer A uploaded a file and when he tries to download it, it navigates to a URL and the file gets downloaded and now if the Customer B uses this same URL even he's able to download the file, therefore how can I restrict this? 

Thank you
VinayVinay (Salesforce Developers) 
Hi Jayanth,

If file is in a private library, then only the file owner has access to it and permissions for files shared with libraries depend on the library.

References:
https://help.salesforce.com/s/articleView?id=sf.collab_files_settings_perms.htm&type=5
https://www.simplysfdc.com/2017/09/salesforce-files-visibility-and-actions.html

Please mark as Best Answer if above information was helpful.

Thanks,
Jayanth G 3Jayanth G 3
Hi Vinay, 

Thank you for your response, don't we have any control on the Download File URL? Like if someone uses this URL in their browser then a check should happen before it starts downloading is the expectation.

Do we have anything to make this happen?

Thank you
VinayVinay (Salesforce Developers) 
Nope when you download there cant be any check points if user has access then it can be downloaded directly.  May be you can try custom logic but I am not sure if we have have check point when downloading.

Thanks,