Skip to content
Back

Accessing secure files from storage via storage.getFileViewURL

  • 0
  • Cloud
xyz
27 Dec, 2025, 11:28

Hi everyone, can someone tell me what is the preferred way of accesssing user only files from storage in react native?

I saved the file with user only read permissions but Im not sure how should we access this file on the client side? getFileView() just returns the plain url and no user information

TL;DR
Developers are discussing accessing secure files from storage using `storage.getFileViewURL`. The solution involves using `listFiles` instead of `getFiles` because the latter requires IDs that the client side might not have. By using `listFiles`, developers can fetch files that the current user has read permission for. To track files easily, it's recommended to create a table with file names, types, and tags. For reading files with user-only permissions on the client side, developers might need to create a token system or track user-specific information separately.
Axistro
27 Dec, 2025, 11:30

could you clarify which type of user data are you expecting from the files? like who uploaded it?

xyz
27 Dec, 2025, 11:31

not really user data per se, but i would expect this to already have a token or something so that the client can read it. Or do we need to add that our selfs?

Axistro
27 Dec, 2025, 11:33

Sorry but could you clarify what kind of data you want client to be able to read? Btw the files dont contain any type of user data with it if you want like who uploaded it type function, you would have to create a table to keep track of it.

xyz
27 Dec, 2025, 11:35

ok maybe i wasnt really clear. My goal is to read a file on the client side that has user only read permission, ie only user id 123 can read it since they uploaded it. Now, i created the file with that permission and its fine, however, i dont know how can i read it on the client side later?

Axistro
27 Dec, 2025, 11:38

you can use listFiles as getfiles method will require ids which in normal case a client side wont have track of./ using listFiles will fetch some files (by default 25 , you can increase or decrease the a amount) which the current user has read permission. the other which this current user does not have permission of , no data will be fetched. you can add another filter layer by keeping track of the files name , type, tags by creating a table . which makes querying files much easier

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more