上传图片时,Codeigniter无法打开流权限 [英] Codeigniter failed to open stream permission when upload images

查看:217
本文介绍了上传图片时,Codeigniter无法打开流权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码:

$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无法打开流权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆