岁月佳醉 2019-03-23 10:44 采纳率: 0%
浏览 908

windows系统php使用ftp上传阿里云服务器,提示No such file or directory

windows系统php使用ftp上传阿里云服务器,提示No such file or directory,上传其他服务器没问题,阿里云ip访问已经设置了,有哪位大神知道如何处理,下面是代码

function FTPuploads() 
    {
        $file = "D:/2019032157946.jpeg";
        $ftp = C('FTP_CONFIG');
        $remote_file = $ftp['ftp_trmote_file'];
        //链接确认
        $conn_id = ftp_connect(trim($ftp['ftp_server']));
        ftp_pasv($conn_id, true);
        if (!$conn_id) {
            //连接失败
            echo 'connect fail';
            die();
        }

        //登录
        $login_result = ftp_login($conn_id, trim($ftp['ftp_user_name']), trim($ftp['ftp_user_pass']));

        if (!$login_result) 
        {
            //登录失败
            echo 'login error';
            //关闭连接
            ftp_close($conn_id);
            die();
        }
        else 
        {
            //登录成功
            //echo 'success';
        }

    //ftp_close($conn_id);die();
        @ftp_pasv($conn_id,1); // 打开被动模拟

        //上传
        if( is_dir($file) ) {
            $contents_on_server = ftp_nlist($conn_id, $remote_file);
            if(!in_array($remote_file."/.", $contents_on_server)) {
                if(!ftp_mkdir($conn_id, $remote_file)) {
                    echo "There was a problem while creating $file/n";
                    exit;
                }
            }

        }
        else 
        {
            $re = @ftp_put($conn_id,$remote_file,$file,FTP_BINARY);
            if (!$re) 
            {
                echo "put fail";
            }
        }

        //关闭连接
        ftp_close($conn_id);
    }
  • 写回答

1条回答 默认 最新

  • threenewbee 2019-03-24 09:26
    关注

    如果你确认只有阿里云不可以的话,那么应该就是根路径权限问题,或者根路径不存在。你可以在阿里云上提交工单让他们的技术帮你看下。

    评论

报告相同问题?

悬赏问题

  • ¥15 如何在3D高斯飞溅的渲染的场景中获得一个可控的旋转物体
  • ¥88 实在没有想法,需要个思路
  • ¥15 MATLAB报错输入参数太多
  • ¥15 python中合并修改日期相同的CSV文件并按照修改日期的名字命名文件
  • ¥15 有赏,i卡绘世画不出
  • ¥15 如何用stata画出文献中常见的安慰剂检验图
  • ¥15 c语言链表结构体数据插入
  • ¥40 使用MATLAB解答线性代数问题
  • ¥15 COCOS的问题COCOS的问题
  • ¥15 FPGA-SRIO初始化失败