简体   繁体   English

警告:ftp_put()期望参数3为有效路径,给定数组

[英]Warning: ftp_put() expects parameter 3 to be a valid path, array given

I'm trying to upload a single file to my ftp directory but unable to upload the file. 我正在尝试将一个文件上传到我的ftp目录,但是无法上传该文件。 I keep getting the following error 我不断收到以下错误

Warning: ftp_put() expects parameter 3 to be a valid path, array given 警告:ftp_put()期望参数3为有效路径,给定数组

<form action="" class="tsc_form_contact_light frame tbar" method='post' enctype="multipart/form-data">       
    <label for="name">ArtWork Name <font color='red'>(required)</font></label>   
    <input type="upload" name="artname" class="form-input" required />
    <label for="name">ArtWork Image</label>     
    <input type="file" id="uploadfile" name="uploadfile"> 
    </form>

    $path_of_storage = '/public_html/newinvoice/orderimage/';
    $newftpdir = $_SESSION['SESS_ORDER_ID'];

    $conn_id = ftp_connect($ftpserver);
    ftp_pasv($conn_id, true); 
    $login_result = ftp_login($conn_id, $ftplogin, $ftppass);

    //ftp_mksubdirs($conn_id,$path_of_storage,$newftpdir);

            $source_file = $_FILES['uploadfile']['tmp_name'];
        $destination_file = "$path_of_storage".$source_file;
        $destination = "$path_of_storage";          

            // check connection
            if ((!$conn_id) || (!$login_result)) { 
                echo "FTP connection has failed!";
                exit; 
            } else {
                echo "Connected";
            }

            // upload the file
            $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); 

            $name = $_FILES["uploadfile"]["name"];
            move_uploaded_file($source_file, "$destination/$name");

    // check upload status
    if (!$upload) { 
    echo "FTP upload has failed! $destination_file";
    } else {
    echo "Uploaded $source_file as $destination_file";
    }

    // close the FTP stream 
    ftp_close($conn_id);

$_FILES contains array of all the uploaded file along with the attributes like name, type, tmp_path etc $ _FILES包含所有上传文件的数组以及诸如名称,类型,tmp_path等的属性

Use $_FILES['uploadfile']['tmp_name'] for the file path 使用$ _FILES ['uploadfile'] ['tmp_name']作为文件路径

Refer to this link for more details 请参阅此链接以获取更多详细信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:ftp_put() 期望参数 3 是一个有效的路径,给定的字符串 - Warning: ftp_put() expects parameter 3 to be a valid path, string given 警告:ftp_put()期望参数1为资源,布尔值在 - Warning: ftp_put() expects parameter 1 to be resource, boolean given in ftp_get()期望参数2为有效路径,并提供资源 - ftp_get() expects parameter 2 to be a valid path, resource given 警告:file_get_contents()期望参数1为有效路径,数组为16 - Warning: file_get_contents() expects parameter 1 to be a valid path, array given 16 file_put_contents() 期望参数 1 为有效路径,字符串给定 - file_put_contents() expects parameter 1 to be a valid path, string given is_dir() 期望参数 1 是有效路径,给定数组 --- Composer --- Drupal - is_dir() expects parameter 1 to be a valid path, array given --- Composer --- Drupal 消息:fopen()期望参数1为有效路径,给定数组 - Message: fopen() expects parameter 1 to be a valid path, array given 警告ftp_put()文件名不能为空 - Warning ftp_put() filename cannot be empty CURL 警告:curl_file_create() 期望参数 1 是有效路径,给定字符串 - CURL Warning: curl_file_create() expects parameter 1 to be a valid path, string given "警告: call_user_func_array() 期望参数 1 是有效的回调,没有给出数组或字符串" - Warning: call_user_func_array() expects parameter 1 to be a valid callback, no array or string given
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM