Reputation: 8602
Good day to all.
I have the following scenario:
1 server with a site that has some forms that will post some data. Part of this data must go to a database, and also there may be some files that needs to be upload.
Problem is that the server is starting 2 run out of space so there have been allocated 1 more server that have as main function to stock the uploaded files. I can access the second server using ssh/ftp/anything.
The restriction is that I can't set the action of forms to post 2 the second server.
So what I'm asking is if I can upload the files 2 the second server without saving them on the first and copy them after that (because of lack of space). Something like setting the upload path like "ftp://secondServerIp/whatever, credentials".
Upvotes: 1
Views: 2393
Reputation: 317177
POST method file uploads will be stored in the server's default temporary directory, unless another location has been given with the upload_tmp_dir
directive in php.ini. This could probably be an NFS file link or if you are only disk space bound, you could point it to a RAM drive, so the files get stored in memory. You'd then copy it to the remote server and delete the file from the RAM drive. Whether this is practical depends on the load you expect.
Another option would be to add a Reverse Proxy on the main machine (for instance nginx) and then transparently proxy the image uploads to be handled by the storage server and everything else be handled by the regular server.
Or you add a mod_rewrite
rule to your Apache that redirects form uploads.
Upvotes: 1
Reputation: 401172
If you can mount an NFS share between your two servers, you could have a folder of the second server appear like a local folder on the first one.
Then, you'd only have to set up that remote folder as destination for your uploads.
Upvotes: 1