dswqw66280 2012-06-05 17:07
浏览 311

成功连接后,ftp_nlist返回false

    <?

//$conn_id = ftp_connect($_GET['host'],21,5) or die ('Cant connect to host!');
$conn_id = ftp_connect($_GET['host']) or die ('Cant connect to host!');
ftp_pasv($conn_id, true);
echo 'host OK<br>';
$login_result = ftp_login($conn_id, addslashes($_GET['user']), $_GET['pass']) or die ('Cant connect with username/pass!');
echo 'conect OK<br>Contents there:';


print_r (ftp_nlist($conn_id,"."));
echo '<br />';
if(ftp_put($conn_id, "just-d-test.html", "img/just-d-test.html", FTP_BINARY))
echo 'put OK';
else
print  'put Failed!';

echo "<p><hr>";
echo phpinfo();
?>

I'm having a problem with ftp_nlist being returned as false.

It connects fine but always returns put Failed (false) for the latter task.

I've disabled the firewall in CentOS with no luck. There is nothing specifically disabled in PHP.ini.

I'm using PHP 5.3.3. When I use FileZilla to access the FTP.XXX it loads the directory perfect.

Does anybody have any idea how to make this work please?

This is what i'm getting http://www.uploadaphoto.co.uk/images/untitled.jpg

  • 写回答

1条回答 默认 最新

  • douyue6520 2012-06-05 17:49
    关注

    Please note that ftp_pasv() can only be called after a successfull login or otherwise it will fail. (source)

    Try execute ftp_pasv($conn_id, true) after ftp_login() command

    评论

报告相同问题?

悬赏问题

  • ¥15 用windows做服务的同志有吗
  • ¥60 求一个简单的网页(标签-安全|关键词-上传)
  • ¥35 lstm时间序列共享单车预测,loss值优化,参数优化算法
  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 一直显示正在等待HID—ISP