我正在创建一个库作为项目的一部分,其中一种方法是上传帮助程序的包装器。
方法:
public function upload(){
echo "Doing upload";
$config['upload_path']= RESOURCE_PATH . "Downloads";
$config['allowed_types']='pdf|doc';
$config['max_size']='10000';
//echo $config['upload_path'];
$this->CI->load->library('upload',$config);
if(!$this->CI->upload->do_upload()){
echo "Couldn't do the upload";
echo $this->CI->upload->display_errors();
echo $config['upload_path'];
}
else{
echo "Could do the upload";
}
}
我检查了下载文件夹的目录权限并且它存在,但我收到以下错误:“上传路径似乎无效。”
我该如何解决这个问题?
编辑:: 我创建了一个符号链接,所以我的目录结构看起来像:
www -> /home/user/Dropbox/www/appname
注意使用的变量:
$this->CI = &get_instance(); // Defined in custom library class
define('RESOURCE_PATH', APPPATH . 'views/resources/'); // Defined in constants.php