Well say i had the upload page on sever 1, but i want the images to go to sever 2, how would i go about doing this?
+rep 5 times kk :D
Printable View
Well say i had the upload page on sever 1, but i want the images to go to sever 2, how would i go about doing this?
+rep 5 times kk :D
Usually I suppose you would have to point the upload form to the PHP File on the other server, ensuring the folder you want the files to go into have the correct permissions.
the upload form has to be on sever 1.
Why don't you have the upload on server 1 upload images to a folder on server 1. Then on server 2 use file_get_contents() to grab the images or files from that particular folder?
Thats a fairly gooooood idea actually, Would it be easy to code dya think?
Ross
Shouldn't be too hard. Or of course you can just have something like this:
Server 1:
Server 2:HTML Code:<form method="post" action="www.server2.com/upload.php" enctype="multipart/form-data" />
<input type="file" name="file" />
<input type="submit" name="submit" value="Upload" />
</form>
PHP Code:<?php
// handles all data from server 1 and uploads it to server 2
?>
hmm, nah i think your first idea was fairly decent...
Right now im confused, would file_get_contents() go in the folder where i want the images to go in? what would i name that file too n the coding in that file?
Ross
Basically you'd do something like this. Somebody correct me if I am wrong.
Now I'm not sure if that works but yeah, try.PHP Code:<?php
$file = "index.php";
$files = file_get_contents('url');
file_put_contents($file, $files);
?>
Normally you would do it by having the upload form and upload handler on server A and an API type handler on B. You would then use CURL on server A to post the data to server B handler, of which would then store the files.
http://forums.devshed.com/php-develo...le-533233.html
that might help with curl a bit, of course you can use php.net/curl
Temp store the images on server A after an upload and add the name to a txt file then put a cron job on server B to download that txt file and copy all the images, then make server B make a txt file with the files its download then a cron job like an hour later to check that txt file and delete the old text file and the images in that txt file.
You COULD do it via connecting to an FTP, I think.
http://www.web-development-blog.com/...load-via-curl/
you are correct.