当我尝试上传文件时,我收到以下错误:
<b>Fatal error</b>: Uncaught CKSource\CKFinder\Exception\InvalidCsrfTokenException: Invalid CSRF token. in D:\xampp\htdocs\mysite\includes\ckfinder\core\connector\php\vendor\cksource\ckfinder\src\CKSource\CKFinder\CKFinder.php:245
Stack trace:
这是ckfinder的新安装
答案 0 :(得分:1)
最简单的解决方案(虽然不推荐)是禁用CKFinder中的CSRF保护。对于PHP连接器,只需将其设置为false
:
$config['csrfProtection'] = false;
建议的方法是让CKFinder生成CSRF令牌并在提交表单时使用它(表单字段应命名为ckCsrfToken
):
var finder;
CKFinder.start({
onInit: function(instance) {
// Save finder instance to use it later
finder = instance;
}
});
// Later you can obtain the token the following way
console.log(finder.request('csrf:getToken'));