Codeigniter failed to open stream permission when upload images

陌路散爱 提交于 2019-12-24 11:14:47

问题


Code:

$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();

Error: Codeigniter failed to open stream permission when upload images.


回答1:


Probably it is a permissions issue. Try this:

sudo chmod -R 777 path/to/public_ftp/incoming/

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

If you are getting this error when trying to upload a file from a form. codeigniter documentation:

The Upload Folder

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.

Do you have this folder with permissions set to 777?



来源:https://stackoverflow.com/questions/30570987/codeigniter-failed-to-open-stream-permission-when-upload-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!