【问题标题】:CodeIgniter download a file to windows via FTPCodeIgniter 通过 FTP 下载文件到 windows
【发布时间】:2013-05-22 02:29:34
【问题描述】:

在我的网站中,我有以下 2 个功能。第一个使用 FTP 连接并在指定路径中创建一个目录。例如 server.com/Host_path/DirectoryName。这段代码工作得很好。我有一个上传功能,将文件 test.txt 上传到文件夹 DirectoryName,第二个功能应该将该文件下载到我的本地 Windows 机器。但是我收到错误消息Unable to download the specified file. Please check your path.,但没有指示哪个路径是错误的。

$path = 'server.com/' . $result['path'];
$this->ftp->mkdir($path);

当我回显远程和本地路径时,我得到 remote = server.com/Host_path/DirectoryName/test.txt and local = C:\Users\Owner\Desktop\test.txt 。基于上述功能有效但以下功能无效的事实,我认为 Windows 路径错误,但可能是功能不同。

$remotePath = 'server.com/' . $result['path'];
$localPath = 'C:\\Users\\Owner\\Desktop\\test.txt';
$this->ftp->download($localPath, $remotePath, 'auto');`

请帮忙!

【问题讨论】:

标签: php codeigniter ftp download


【解决方案1】:

对于remotePath,使用以“/”开头的绝对路径

【讨论】:

  • 没用。我正在使用 CodeIgniter,所以应该有一些方法可以使用 base_url() 或其他东西。
猜你喜欢
  • 1970-01-01
  • 2012-08-18
  • 2020-05-25
  • 1970-01-01
  • 2012-10-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多