Sometimes in order to achieve the load or other reasons, we need to put the uploaded files on the other server, because I am not familiar with the server tools, so only from the PHP program, through PHP FTP or curl to implement the upload file to the remote server
Of course, both of these methods need to be uploaded to the current Web server before being transferred to another server
The first method is to upload FTP to the remote server, which requires a remote server FTP IP address FTP user and FTP password has permission allowed directory location
Using the FTP class provided by www.yawill.com, please see the attachment for the specific use of this class
[PHP]
<?php
Require "./ftp.class.php";
$a = "";//local Path
$b = "";//remote file filename
$ftp = new Clsftp ("username", "password", ' 202.202.202.202 ');//Modify Settings yourself
$ftp->cd (' web ');//change to the directory, if you need to upload to the root directory you don't have to change it.
$ftp->put ($b, $a. " /". $b);//put file
$ftp->close ();
?>
[/php]
2. Another method is to use curl to submit
This in the process of uploading with ordinary PHP upload is not much different, but need to prevent others malicious upload, the source program is the work of other netizens, unfortunately the Web site can not be opened
[PHP]
<?php
echo "<pre>";
Print_r ($_post);
Print_r ($_files);
echo "</pre>";
This is the upload process for the remote server.
if (Move_uploaded_file ($_files[' file1 ' [' Tmp_name '][1], './test.txt ')) {
echo ' OK ';
}
?>
[/php]