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