du59131 2014-07-10 16:24
浏览 61

使用ftp_put上传到服务器时出现问题

Heres my code:

                $host = 'ftp.uscdls.com'; 
                $usr = 'something'; 
                $pwd = 'something';         
                $local_file = 'img.png'; 
                $ftp_path = '/www.something.com'; 
                $conn_id = ftp_connect($host, 21) or die ("Cannot connect to host");      
                ftp_pasv($conn_id, true); 
                ftp_login($conn_id, $usr, $pwd) or die("Cannot login"); 
                // perform file upload 
                ftp_chdir($conn_id, 'load_uploads'); 
                $upload = ftp_put($conn_id, $ftp_path, $local_file, FTP_ASCII); 
                if($upload) { $ftpsucc=1; } else { $ftpsucc=0; } 
                // check upload status: 
                print (!$upload) ? 'Cannot upload' : 'Upload complete'; 
                print "
"; 
                // close the FTP stream 
                ftp_close($conn_id); 

It's failing on the line where it ouputs "Cannot Upload". Ive rewritten this a couple times and i keep getting the same error. Hoping someone has a better set of eyes on this. Again so appreciated for any help!! thanks!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信会员卡接入微信支付商户号收款
    • ¥15 如何获取烟草零售终端数据
    • ¥15 数学建模招标中位数问题
    • ¥15 phython路径名过长报错 不知道什么问题
    • ¥15 深度学习中模型转换该怎么实现
    • ¥15 HLs设计手写数字识别程序编译通不过
    • ¥15 Stata外部命令安装问题求帮助!
    • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
    • ¥15 TYPCE母转母,插入认方向
    • ¥15 如何用python向钉钉机器人发送可以放大的图片?