Shortly: How to copy files (images) remotely between two servers by running cgi-script in web browser?
I'm trying to copy files (images) from server where script is working to another server while script running. In reality when people upload their picture to my website, it actually gets (or rather should get) copied to another website too (mirror copy).
Now, best way to do it so far I found out to be using $ftp->put. I can login to my server, read file and dir lists, create dirs, change to another dir, but can't upload. This is to remote server only. I can upload images to same server where script is running fine, but the problem is in FTP'ing part.
I made short script to create dir, then manually (by ws_ftp) chmoded it to 777 and tried to upload with no success. Running out of ideas. Only other way I can think of is pasv_xfer that I found from google, but never used it and can't make it work either. There must be better ways to do this. There's some code I've tried:
Code:
sub ftp_upload {
$ftp->binary();
$file = "http\:\/\/www\.sourceserver\.net\/pages\/folder\/upload\/dir\/img\/test\.jpg";
$ftp->put ($file) or print "problem1<br>";
} # End of ftp_upload subroutine.
I'm also using
print "Content-type: text/html\n\n"; to make it work thru browser.
Thanks in advance!
<db>