我需要使用我的 codeigniter 应用程序从我的本地主机上传一个 zip 到我的网络服务器。我已按照文档进行操作,但无法上传文件,错误是:
An Error Was Encountered
Unable to locate the source file. Please check your path.
我不知道为什么它找不到源路径,如果我尝试用file_exists
它测试路径,但是upload
方法失败了......
这是我的代码:
$this->load->library('ftp');
$config_ftp['hostname'] = 'xxxxx';
$config_ftp['username'] = 'xxxxx';
$config_ftp['password'] = 'xxxxx';
$config_ftp['debug'] = TRUE;
$this->ftp->connect($config_ftp);
if(file_exists($my_file))
echo "ok";
else
echo "no";
$this->ftp->upload($my_file , '/web/'.$my_file, 'binary');