用FTP函数可以实现..具体看看PHP手册..

解决方案 »

  1.   

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
      <meta http-equiv="content-type" content="text/html; charset=windows-1250">
      <meta name="generator" content="PSPad editor, www.pspad.com">
      <title></title>
      </head>
      <body>
    <!-- The data encoding type, enctype, MUST be specified as below -->
    <form enctype="multipart/form-data" action="http://localhost/PHP_Dev/File_handling.php" method="POST">
        <!-- MAX_FILE_SIZE must precede the file input field -->
        <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
        <!-- Name of input element determines name in $_FILES array -->
        Send this file: <input name="userfile" type="file" />
        <input type="submit" value="Send File" />
    </form>
      </body>
    </html><?php
    // In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
    // of $_FILES.$uploaddir = 'uploads/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);echo '<pre>';
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        echo "File is valid, and was successfully uploaded.\n";
    } else {
        echo "Possible file upload attack!\n";
    }echo 'Here is some more debugging info:';
    print_r($_FILES);print "</pre>";?> 
      

  2.   

    服务器间复制可以用多种方式最简单的就是 当用户上传到服务器A后,服务器A把文件地址xxx告诉给服务器B,让服务器B去下载服务器A的文件
    A.php
    file_get_content("http://{$ServerB}/B.php?url=xxxx");B.php
    $data = file_get_content("http://{$ServerA}/{$url}");
    $fp   = fopen($url, "w");
    fputs($fp, $data);
    fclose($fp);
      

  3.   

    lz也可以直接使用Linux下面的SCP这个command来实现你的要求阿
    在PHP部分上传完毕后,执行SCP 直接copy文件就可以阿
      

  4.   

    方案一:可以用一台服务器作主上传服务器,别的服务器只作同步操作。rsyncd + rsync 可以完成同步操作,同步操作可以在B服务器上设置一个触发器触发同步,也可以用cron来定时同步。触发器可以简单地使用一个php程序去fork一个后台同步进程。适用于远程服务器同步,服务器间连接速度不理想的情况。方案二:可以考虑使用NFS,把B服务器上的分区挂载到A服务器上,在A服务器看来,跟使用本地分区没有区别。直接用copy就可以完成。适用于服务器间连接速度快的情况。