问题
I have photo uploading functionality in web application using PHP. Which is going to host as distributed application on many servers.
Now, problem is how should I handle that photo uploading functionality so, that photo can be available on all server? My application is in php.
回答1:
You could use an already existing platform to perform syncing. Most modern OSes support syncing, and you could also use external tools.
At the OS level:
- You can use rsync for *nix servers (plus, this has been ported to Windows too)
- Here's a way to do it between Windows servers
Using external tools:
- Goodsync enterprise
- Syncbreeze
- Under *nix, you could use rsync
- Here's a collection of programs (free and paid) to do this
- You could use a cloud-based service like Dropbox in all your servers
Using PHP:
- You could use librsync
- You could add an FTP/SSH server to each one of your distributed servers. Once a file is uploaded to one server, it can be uploaded via FTP to the others. PHP includes functionality for FTP - check the FTP section in the PHP handbook.
- Use FXP to transfer files between servers. The KioobFTP class can be used for this, as it implements FXP transfers
来源:https://stackoverflow.com/questions/17022047/how-do-i-handle-file-uploading-on-distributed-application