Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/290.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php CKFinder无法上载图像,导致打开流失败:权限被拒绝_Php_Ckfinder - Fatal编程技术网

Php CKFinder无法上载图像,导致打开流失败:权限被拒绝

Php CKFinder无法上载图像,导致打开流失败:权限被拒绝,php,ckfinder,Php,Ckfinder,这个问题困扰了我好几天了。我刚刚安装了CKfinder,“浏览”功能完美无瑕。除非我想上传图像或文件,否则会出现以下错误: 致命错误:未捕获的异常“ErrorException”与消息 'fopen(/home/xxx/app/userfiles/images/sdfdsf.jpg):无法打开 流:中的权限被拒绝 /home/xxx/app/webroot/js/packages/finder/core/connector/php/vendor/league/flysystem/src/Adap

这个问题困扰了我好几天了。我刚刚安装了CKfinder,“浏览”功能完美无瑕。除非我想上传图像或文件,否则会出现以下错误:

致命错误:未捕获的异常“ErrorException”与消息 'fopen(/home/xxx/app/userfiles/images/sdfdsf.jpg):无法打开 流:中的权限被拒绝 /home/xxx/app/webroot/js/packages/finder/core/connector/php/vendor/league/flysystem/src/Adapter/Local.php:142

我使用了以下设置:

$config['backends'][] = array(
    'name'         => 'default',
    'adapter'      => 'local',
    'baseUrl'      => '/app/userfiles/',
    'chmodFiles'   => 0777,
    'chmodFolders' => 0755,
    'filesystemEncoding' => 'UTF-8',
);

$config['backends'][] = array(
    'name'         => 'ftp',
    'adapter'      => 'ftp',
    'host'         => 'xxx',
    'username'     => 'xxx',
    'password'     => 'xxx'
);

$config['resourceTypes'] = array(
    array(
        'name'              => 'Files',
        'directory'         => '/home/websites/www/shared/images/ckfinder/',
        'maxSize'           => 0,
        'allowedExtensions' => 'pdf,doc,zip',
        'backend'           => 'ftp',
        'lazyLoad'          => true
    ),
    array(
        'name'              => 'Images',
        'directory'         => '/home/websites/www/shared/images/ckfinder/',
        'maxSize'           => 0,
        'allowedExtensions' => 'gif,jpeg,jpg,png',
        'backend'           => 'ftp',
        'lazyLoad'          => true
    )
 );
如上所述,浏览位于/app/userfiles/中的图像效果非常好。它甚至将名称返回到我的输入字段

但是现在我想上传一个图像或文件,我得到了这个错误。谁能告诉我如何解决这个问题

另外,文件夹上有CHMOD 777,这样就可以了。似乎错误表明它正在尝试上载文件,或从错误的目录访问文件,例如,我的设置错误:)


这只是一个测试,但本地资源将被删除,图像/文件浏览应仅从FTP进行,与上载目录相同,即:)

看起来您试图为资源类型定义绝对路径。资源类型的
目录
选项中使用的路径应相对于所用后端的

请查看PHP连接器文档中的以下位置:

您可以使用绝对路径定义后端
,然后使用相对于资源类型
目录
选项中定义的根的路径。例如:

$config['backends'][] = array(
    'name'         => 'ftp',
    'adapter'      => 'ftp',
    'host'         => 'xxx',
    'username'     => 'xxx',
    'password'     => 'xxx',
    'root'         => '/home/websites/www/shared/images/ckfinder/'
);

$config['resourceTypes'] = array(
    array(
        'name'              => 'Images',
        //'directory'         => '', You can also omit this option - the resource type in this case will be attached to the backend root
        'maxSize'           => 0,
        'allowedExtensions' => 'gif,jpeg,jpg,png',
        'backend'           => 'ftp',
        'lazyLoad'          => true
    )
 );