php远程文件无法编辑,php/zend/ssh-无法接收远程文件

我试图连接我的ssh服务器并下载一个文件,但我遇到了一个问题,我不明白为什么。文件确实存在,我在网上搜索,但没有找到任何东西来解开这个漏洞。

错误:

复制错误:2

ssh2_scp_recv()[函数.ssh2 scp recv]:无法接收远程文件

我的代码:

public function ajaxdownloadfileAction() {

$this->_helper->layout->disableLayout();

$this->_helper->viewRenderer->setNoRender();

$this->view->lib = $this->_labelsFile;

$connection = ssh2_connect($this->_configFile->ftp->hostname, $this->_configFile->ftp->port);

if ($connection) {

$login = ssh2_auth_password($connection, $this->_configFile->ftp->login, $this->_configFile->ftp->password);

if ($login) {

$content = true;

if ($content) {

$local = ' C:\Users\Public\Downloads ';

$fileName = "\\Talend\\PEC_DF6\\FluxSortantAdmissionPEC\\ARCHIVES\\XML\\wzadyyyy.0001054581.ap.xml";

if(!@ssh2_scp_recv($connection,$fileName,$local)){

$errors= error_get_last();

echo "COPY ERROR: ".$errors['type'];

echo "
\n".$errors['message'];

}

else {

echo "File copied from remote!";

}

//$filename = $this->getRequest()->getParam('name');

// $fileName = "\\Talend\\PEC_DF6\\FluxSortantAdmissionPEC\\ARCHIVES\\XML\\wzadyyyy.0001054581.ap.xml";

//$fileName = $this->_getParam('fileName');

//echo $fileName;die;

//ssh2_scp_recv($connection,$filename,$local);

}

$connection = null; unset($connection);

}

}

/* $result['status'] = 'OK';

$result['message'] = 'LE ficheir a bien ete telecharger';

echo json_encode($result);*/

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值