CodeIgniter:上载路径似乎无效 [英] CodeIgniter: The upload path does not appear to be valid
问题描述
我在CodeIgniter图像上传的上传功能中遇到此错误。
I am getting this error in the upload functionality for CodeIgniter Image upload.
上传路径似乎无效
此问题是在我从本地系统上载站点到实时系统后开始发生的。
This problem started happening after I uploaded the site from my local system to my live system.
我正在添加我的下面的代码。我不知道怎么了我已经浏览了所有其他论坛。但是没有任何帮助。
I am adding my code below. I don't know what is wrong. I have gone through all the other forums on this. But nothing helped.
$config['upload_path'] = 'uploads';
$config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
$this->load->library('upload',$config);
$this->upload->initialize($config);
该文件夹具有完全权限,正如我所说的,它在本地系统上正常工作。不知道可能是什么问题。任何帮助将不胜感激。
The folder has full permissions, and as I said it was working on my local system. Not sure what the issue could be. Any help will be greatly appreciated.
推荐答案
$config['upload_path'] = 'uploads';
上传路径
目录必须可写,并且路径可以是绝对路径或相对路径。如果您的上载文件夹位于文档根目录中,则 ./ uploads /
应该有效,或 FCPATH可以。 'uploads /'
(检查FCPATH是否带有斜杠,如果没有将其添加到上载中)。
upload path
directory must be writable and the path can be absolute or relative. If your uploads folder is in your document root then ./uploads/
should work or FCPATH . 'uploads/'
(check if FCPATH has a trailing slash, if not add it to uploads).
此外,该路径还必须存在,CodeIgniter不会为您创建目录。
Aside from that the path has to exist, CodeIgniter won't make the directory for you.
这篇关于CodeIgniter:上载路径似乎无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!