Ckeditor 5 - 无法上传文件:logo.jpg / codeigniter 4
我正在尝试实现 ckeditor5 和 SimpleUploadAdapter。我收到错误,无法上传文件:logo.jpg
ClassicEditor
.create( document.querySelector( '#post_body' ), {
simpleUpload: {
// The URL that the images are uploaded to.
uploadUrl: 'https://example.com/upload/posts/',
// Enable the XMLHttpRequest.withCredentials property.
withCredentials: true,
// Headers sent along with the XMLHttpRequest to the upload server.
headers: {
'X-CSRF-TOKEN': +CKeditorToken_name,
Authorization: 'Bearer ' +CKeditorToken_hash,
}
}
} )
.catch( error => {
console.error( error );
} );
我对 X-CSRF-TOKEN
和 Authorization
有点困惑要求。我正在传递 csrf_token() 的值,这是当前 CSRF 令牌的名称和 csrf_hash() 这是 CSRF 哈希的当前值。这是这里所需要的吗?
另外,对于上传网址,这是正确的;
uploadUrl: 'https://example.com/upload/posts/
或者 uploadUrl: 'https://example.com/upload/posts
在控制台中,显示以下错误:
simpleuploadadapter.js:224 POST https://example.com/upload/posts/ 404 (Not Found)
非常感谢任何指针或指导。
我对目录权限和路径进行了双重和三次检查,一切都很好。
I am trying to implement ckeditor5 and SimpleUploadAdapter. I get an error, Couldn't upload file: logo.jpg
ClassicEditor
.create( document.querySelector( '#post_body' ), {
simpleUpload: {
// The URL that the images are uploaded to.
uploadUrl: 'https://example.com/upload/posts/',
// Enable the XMLHttpRequest.withCredentials property.
withCredentials: true,
// Headers sent along with the XMLHttpRequest to the upload server.
headers: {
'X-CSRF-TOKEN': +CKeditorToken_name,
Authorization: 'Bearer ' +CKeditorToken_hash,
}
}
} )
.catch( error => {
console.error( error );
} );
I am a bit confused as to what X-CSRF-TOKEN
and Authorization
require. I am passing the value of csrf_token() which is the name of the current CSRF token and csrf_hash() which is the current value of the CSRF hash. Is that what is needed here?
Also, for the upload url, which is correct;
uploadUrl: 'https://example.com/upload/posts/
or
uploadUrl: 'https://example.com/upload/posts
In the console, the following error is shown:
simpleuploadadapter.js:224 POST https://example.com/upload/posts/ 404 (Not Found)
Any pointer or guidance much appreciated.
I have double and triple checked directory permissions and path and all are ok.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论