I'm currently working on a file manager, think of it as google drive in my own application, however, I need to allow the file owner to share files between users, but I'm not sure how to approach this. I hope that some of you would be able to provide some viable insight into this matter. I plan to use this with an S3 bucket and then store the file information and path in the database.
First you should create a route for files, something like example.com/files/{file_id}. Then you create a many-to-many relationship with between file and users who can access it.
And maybe you store a uuid to the file and if someone has it will also be able to access it via a route like example.com/files/{file_id}/{uuid]
Use your database to manage file permissions (owner, shared users, access level) and check these before generating pre-signed S3 URLs. This way, only authorized users can access or download the shared files. You made a tremendous product by merging the idea of storing files like cloud and sharing large data with each other like https://xendarapp.com .