The application I am developing allows users to upload avatars for their profile. Since the app uses two separate front-facing webservers, we intend to use a separate fileserver to store the image files. The code I use successfully uploads the files to a directory in the webserver. What is the best way to successfully get the files onto a fileserver? It uses an upload code called 'class.upload.php' that I found here https://www.verot.net/php_class_upload.htm
Here is the code:
require_once('class.upload.php');
$foo = new Upload($_FILES['fileToUpload']);
if ($foo->uploaded) {
// save uploaded image with a new name,
// convert to .jpg
// resized to 50px by 50px
$foo->file_new_name_body = $tablename;
$foo->file_auto_rename = true;
$foo->image_convert = jpg;
$foo->image_resize = true;
$foo->image_ratio_crop = true;
$foo->image_y = 50;
$foo->image_x = 50;
//THIS LINE CURRENTLY SPECIFIES UPLOAD PATH ON WEBSERVER
$foo->Process('avatars/');
// THE LINE BELOW IS WHAT I TRIED AND GOT A 'Can't create file path' ERROR
//$foo->Process('http://XXX.XXX.XXX.XXX/PATH/TO/avatars/');
if ($foo->processed) {
//echo 'image renamed, resized x=100 and converted to JPG';
$foo->Clean();
...then goes on with upload processing since upload is successful.
}
}
where XXX.XXX.XXX.XXX is the IP of the fileserver.
Thanks in advance for your help. If there's anything I can do to make the question better please let me know. Thanks!