问题描述
代码:
$filename = '12345.jpeg';
$source = imagecreatefromstring($imageData);
$imageSave = imagejpeg($source,$filename,100);
imagedestroy($source);
$this->ftp->connect();
$this->ftp->upload($imageSave,'/public_ftp/incoming/'.$filename,'ascii', 0775);
$this->ftp->close();
错误:
上传图片时Codeigniter无法打开流权限。 strong>
Error:Codeigniter failed to open stream permission when upload images.
推荐答案
这可能是一个权限问题。尝试此操作:
Probably it is a permissions issue. Try this:
sudo chmod -R 777 path/to/public_ftp/incoming/
但是,这将授予每个人的权限。对于localhost这是确定。但对于生产环境,你应该用另一种方式。检查更多信息
However, this will give permission to everyone. For localhost this is ok. But for production environment you should do it in another way. Check this answer for more info
@edit
如果您在尝试上传文件时收到此错误从一个窗体。 codeigniter :
If you are getting this error when trying to upload a file from a form. codeigniter documentation:
您上传的图片。在您的CodeIgniter安装根目录下创建一个名为上传的
文件夹,并将
的文件权限设置为777.
You'll need a destination folder for your uploaded images. Create a folder at the root of your CodeIgniter installation called uploads and set its file permissions to 777.
您有此权限设置为777的文件夹吗?
Do you have this folder with permissions set to 777?
这篇关于上传图片时,Codeigniter无法打开流权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!