gpt4 book ai didi

ckfinder - 无法打开 CKFinder - 资源类型无效

转载 作者:行者123 更新时间:2023-12-02 01:32:46 25 4
gpt4 key购买 nike

我正在尝试设置一个新的 CKFinder 3 实例(与 CKEditor 集成),并且正在绞尽脑汁试图追踪并解决这个问题。对不起,文字墙。

当我尝试打开“浏览”窗口时(窗口一打开),我就得到了加载颤动和上传文件夹中生成的以下日志(我打开了调试日志记录)。

[2015-10-19 23:05:41] CKFinder.ERROR: exception 'CKSource\CKFinder\Exception\InvalidResourceTypeException' with message 'Invalid resource type: ' in C:\inetpub\wwwroot\*snip*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Config.php:376

Stack trace:
#0 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\ResourceType\ResourceTypeFactory.php(34): CKSource\CKFinder\Config->getResourceTypeNode('')
#1 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Filesystem\Folder\WorkingFolder.php(96): CKSource\CKFinder\ResourceType\ResourceTypeFactory->getResourceType('')
#2 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(117): CKSource\CKFinder\Filesystem\Folder\WorkingFolder->__construct(Object(CKSource\CKFinder\CKFinder))
#3 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\pimple\pimple\src\Pimple\Container.php(112): CKSource\CKFinder\CKFinder->CKSource\CKFinder\{closure}(Object(CKSource\CKFinder\CKFinder))
#4 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(288): Pimple\Container->offsetGet('working_folder')
#5 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Command\CommandAbstract.php(68): CKSource\CKFinder\CKFinder->getWorkingFolder()
#6 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CommandResolver.php(150): CKSource\CKFinder\Command\CommandAbstract->checkPermissions()
#7 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php(133): CKSource\CKFinder\CommandResolver->getController(Object(Symfony\Component\HttpFoundation\Request))
#8 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#9 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(491): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#10 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(261): CKSource\CKFinder\CKFinder->handle(Object(Symfony\Component\HttpFoundation\Request))
#11 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\connector.php(20): CKSource\CKFinder\CKFinder->run()
#12 {main} [] []

我用来访问 CKFinder 的 URL 是 http://*SNIP*/resources/other/ckfinder/ckfinder.html?type=Images,所以资源类型肯定设置为必需的。它也肯定存在于配置中,如下所示。

这是尝试使用快速上传工具时记录的异常:

[2015-10-19 23:06:19] CKFinder.ERROR: exception 'CKSource\CKFinder\Exception\UnauthorizedException' with message 'Unauthorized' in C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\Command\CommandAbstract.php:75
Stack trace:
#0 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CommandResolver.php(150): CKSource\CKFinder\Command\CommandAbstract->checkPermissions()
#1 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php(133): CKSource\CKFinder\CommandResolver->getController(Object(Symfony\Component\HttpFoundation\Request))
#2 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\symfony\http-kernel\Symfony\Component\HttpKernel\HttpKernel.php(66): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#3 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(491): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#4 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php(261): CKSource\CKFinder\CKFinder->handle(Object(Symfony\Component\HttpFoundation\Request))
#5 C:\inetpub\wwwroot\*SNIP*\resources\other\ckfinder\core\connector\php\connector.php(20): CKSource\CKFinder\CKFinder->run()
#6 {main} [] []

以及一些选定的 config.php 相关部分(注意 $_SESSION['guid'] 设置较早,不是问题的原因):

...

$config['authentication'] = function() {
if (isset($_SESSION['guid'])) {
return true;
} else {
return false;
}
};

...

$config['backends'][] = array(
'name' => 'default',
'adapter' => 'local',
'baseUrl' => '/resources/uploads/'.$_SESSION['guid'].'/',
// 'root' => '', // Can be used to explicitly set the CKFinder user files directory.
'chmodFiles' => 0777,
'chmodFolders' => 0755,
'filesystemEncoding' => 'UTF-8',
);

...

$config['defaultResourceTypes'] = '';

$config['resourceTypes'][] = array(
'name' => 'Files', // Single quotes not allowed.
'directory' => 'files',
'maxSize' => 0,
'allowedExtensions' => 'doc,docx,gif,jpeg,jpg,pdf,png,ppt,pptx,xls,xlsx',
'deniedExtensions' => '',
'backend' => 'default'
);

$config['resourceTypes'][] = array(
'name' => 'Images',
'directory' => 'images',
'maxSize' => 0,
'allowedExtensions' => 'gif,jpeg,jpg,png',
'deniedExtensions' => '',
'backend' => 'default'
);

...

$config['accessControl'][] = array(
'role' => '*',
'resourceType' => '*',
'folder' => '/',

'FOLDER_VIEW' => true,
'FOLDER_CREATE' => true,
'FOLDER_RENAME' => true,
'FOLDER_DELETE' => true,

'FILE_VIEW' => true,
'FILE_UPLOAD' => true,
'FILE_RENAME' => true,
'FILE_DELETE' => true,

'IMAGE_RESIZE' => true,
'IMAGE_RESIZE_CUSTOM' => true
);
...

路径设置正确并具有正确的权限。 CKFinder 成功创建了 '' 文件夹以及 .ckfinder 子文件夹。如果使用快速上传工具,它还会创建“图像”或"file"子文件夹,但不会上传任何内容。

即使我明确设置了 $config['authentication'] = true;,快速上传工具也会显示“未授权”异常。

其他相关信息:

  • PHP 5.6.7

  • Windows Server 2012 R2/IIS 8.5

  • CKEditor 4.5.3

在过去的几周里,我一直在绞尽脑汁并试图对其进行追踪,因此我们将不胜感激。

最佳答案

我发现在 config.php 中明确列出默认资源类型可以解决这个问题。我认为这是一个错误,因为 documentation表示如果此字段保留为空字符串,则会加载所有资源类型,但将其保留为空字符串似乎会破坏初始化过程。

例如,在config.php中,替换:

$config['defaultResourceTypes'] = '';

与:

$config['defaultResourceTypes'] = 'Files,Images';

关于ckfinder - 无法打开 CKFinder - 资源类型无效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33215839/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com