How do I handle file uploading on distributed application?

435 Views Asked by At

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

There are 1 best solutions below

0
Filippos Karapetis On BEST ANSWER

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:

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