移动上传到另一个pc / ip地址的文件

时间:2015-08-26 07:19:59

标签: php apache file-upload upload

我只是想问一下是否可以创建目录并使用mkdir和move_uploaded_file将上传的文件存储到另一台PC的共享文件夹中。我尝试在本地做它工作正常,但当我尝试这个代码

if($_REQUEST['submit']){
    $app_name = $_POST['name'];
    $desc = $_POST['description'];
    $file_url = "192.168.3.34/testupload/files/$app_name/" . $_FILES["file"]["name"];
    $photo_loc = "192.168.3.34/testupload/images/$app_name/" . $_FILES["photo"]["name"];
    $select = $_POST['select'];
    $date = date('m/d/y h:i:s A');

    mkdir("192.168.3.34/testupload/files/$app_name/");
    mkdir("192.168.3.34/testupload/images/$app_name/");
    /* some codes here  that is working */

    if($file != "" ){
        if (file_exists("..192.168.3.34/testupload/files/$app_name/" . $_FILES["file"]["name"]) && file_exists("..192.168.3.34/testupload/images/$app_name/" . $_FILES["photo"]["name"])) {
            die("File Exists");
        }
        move_uploaded_file($_FILES["file"]["tmp_name"],
            "192.168.3.34/testupload/files/$app_name/" . $_FILES["file"]["name"]);


        if($photo_url != "") {
            move_uploaded_file($_FILES["photo"]["tmp_name"],
                "192.168.3.34/testupload/images/$app_name/" . $_FILES["photo"]["name"]);

        }
        $name = escape($_REQUEST['name']);
        $description = escape($_REQUEST['description']);
        //$query = "INSERT into files (name, description,file_name,photo_url,date_uploaded) values ('{$name}', '{$description}','{$file}', '{$photo_url}', now() )";
        //mysql_query($query) or die("Error in Query" . mysql_error());

        //commit();
        //redirect("manage.php");

        $file_loc = "192.168.3.34/testupload/files/$app_name/" . $_FILES["file"]["name"];
        $photo_loc = "192.168.3.34/testupload/images/$app_name/" . $_FILES["photo"]["name"];
    }
}else{
    set_error("File not Found");
    //redirect('manage.php');
}

我试图更改“\”中的“/”并仍然收到此错误

  

警告:mkdir()[function.mkdir]:没有这样的文件或目录   第12行的C:\ xampp \ htdocs \ atts_update \ upload.php

     

警告:mkdir()[function.mkdir]:没有这样的文件或目录   第13行的C:\ xampp \ htdocs \ atts_update \ upload.php

     

警告:   move_uploaded_file(192.168.3.34/testupload/files/1111111111111/sss.txt)   [function.move-uploaded-file]:无法打开流:没有这样的文件或   第71行的C:\ xampp \ htdocs \ atts_update \ upload.php中的目录

     

警告:move_uploaded_file()[function.move-uploaded-file]:无法执行   将'C:\ xampp \ tmp \ php610B.tmp'移动到   '192.168.3.34/testupload/files/1111111111111/sss.txt'in   第71行的C:\ xampp \ htdocs \ atts_update \ upload.php

     

警告:   move_uploaded_file(192.168.3.34/testupload/images/1111111111111/Picture-in-a-picture4aaa.jpg)[function.move-uploaded-file]:无法打开流:没有这样的文件或   第76行的C:\ xampp \ htdocs \ atts_update \ upload.php中的目录

     

警告:move_uploaded_file()[function.move-uploaded-file]:无法执行   将'C:\ xampp \ tmp \ php611C.tmp'移动到   第76行的C:\ xampp \ htdocs \ atts_update \ upload.php中的'192.168.3.34/testupload/images/1111111111111/Picture-in-a-picture4aaa.jpg'

0 个答案:

没有答案