C
C
CloudMonster2014-03-24 14:37:14
linux
CloudMonster, 2014-03-24 14:37:14

How to make the Share function like in Dropbox?

Hello. I did not find an answer to my question on the Internet.
I am developing a file storage. I want to tie the share function like in Dropbox.
The server part of the repository is written in php.
The client uses javascript.
An authorized user downloads their file by sending header headers.
The structure of file placement on the server looks like this:
- userfiles (folder in the root of the site)
- - [email protected] (user folder)
- - - Here are all the files of this user
Everything works, but I don’t know how to make the Share function .
I would be grateful for any ideas.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stepan, 2014-03-24
@CloudMonster

A very strange model was chosen, but... To each his own)
Regarding the question, then for you there is only 1 option is to create a temporary folder for each shared file from which you will give files without authorization.
ps. There are many downsides to your scheme. For example:
- how will you deal with file duplication among users?
- Scaling files of one user across different servers?
- scale active and old files across servers depending on the load on the channel..

A
Anton Guz, 2014-03-24
@aguz

The thing is that the physical placement of files on the server does not have to match the pattern of URLs that the user will see.
userfiles - this may well be a virtual path (location in terms of nginx)
Then it will be easier to construct a path for sharing.
On the server, the file structure can be
- files - storage address
- - adc/dcf - folder whose name is constructed from the file name
- - - adcf832dnewjernrr43n5.png - file name in storage
In parallel, you will need a database to store links
adcf832dnewjernrr43n5 -> Origin file name | size | access date | Owner user | smth else
After that, using the application, you can redirect /userfiles/[email protected]/Pretty_image.png to
/files/adc/dcf/adcf832dnewjernrr43n5.png /share/adcf832dnewjernrr43n5/Pretty_image.png check access and redirect to /files/adc/dcf again /adcf832dnewjernrr43n5.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question