我的问题是,当上传文件时,会显示以下错误。我该如何解决这个问题?
这是我在模板中的代码:
<script src="/vendor/unisharp/laravel-ckeditor/ckeditor.js"></script>
<script src="/vendor/unisharp/laravel-ckeditor/adapters/jquery.js"></script>
<textarea name="content" class="form-control my-editor"></textarea>
<script>
$('textarea.my-editor').ckeditor({
filebrowserImageBrowseUrl: '{!! route('elfinder.ckeditor') !!}',
});
</script>

我不知道为什么,虽然再次有令牌操作无法执行和错误量显示
ckeditor文件:
$().ready(function() {
var elf = $('#elfinder').elfinder({
// set your elFinder options here
<?php if($locale){ ?>
lang: '<?= $locale ?>', // locale
<?php } ?>
<?php if($csrf){ ?>
data: { _token: '<?php echo csrf_field(); ?>' },
<?php } ?>
url: '<?= route('elfinder.connector') ?>', // connector URL
getFileCallback : function(file) {
window.opener.CKEDITOR.tools.callFunction(funcNum, file.url);
window.close();
}
}).elfinder('instance');
});这不起作用:(
发布于 2016-03-25 17:52:54
Laravel 5在web中间件中添加了一个VerifyCSRF令牌。它基本上所做的是注入一个令牌,以便稍后在用户提交表单时进行验证,以防止跨站点请求伪造(CSRF)攻击。
您可以在app/Http/Kernel.php中禁用它,但不建议这样做。
其他选项是在发出请求时将令牌包括在您的表单中,以发送到服务器。
将此添加到您的表单中。
{{ csrf_field() }}它将生成以下HTML块:
<input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">请参阅:Laravel docs on this
发布于 2016-04-20 14:08:30
将你的elfinder选项更改为"customData“来发送额外的POST数据。
$().ready(function () {
var elf = $('#elfinder').elfinder({
// set your elFinder options here
customData: {
_token: '<?php echo csrf_token() ?>'
},
dialog: {width: 900, modal: true, title: 'Select a file'},
resizable: false,
commandsOptions: {
getfile: {
oncomplete: 'destroy'
}
},
getFileCallback: function (file) {
$('<?php echo $input_id?>').summernote('editor.insertImage',files.url);
}
}).elfinder('instance');
});您的选项是data,将其更改为customData。还可以使用csrf_token()发送csrf内标识的值
https://stackoverflow.com/questions/36216817
复制相似问题