上传到FTP时出错(PHP)

时间:2013-07-16 15:28:30

标签: php html upload ftp

我正在尝试使用以下内容将文件上传到FTP:

    $ftp_server="***********"; 
 $ftp_user_name="*********"; 
 $ftp_user_pass="************"; 
 $file = $path;//tobe uploaded 
 $remote_file = "/htdocs/site2/telemessages/en/".$_SESSION['dir']; 

// set up basic connection 
 $conn_id = ftp_connect($ftp_server); 

// login with username and password 
 $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); 

  //upload a file 
 if (ftp_put($conn_id, $remote_file, $file, FTP_ASCII)) { 
  echo "successfully uploaded $file\n"; 
    exit; 
 } else { 
    echo "There was a problem while uploading $file\n"; 
    exit; 
    } 
 // close the connection 
 ftp_close($conn_id)

但是,我收到此错误消息:

http://puu.sh/3EiVO.png

提前致谢。

1 个答案:

答案 0 :(得分:0)

您应该将要上传文件的文件夹的权限更改为它 你可以使用chmod 777