简体   繁体   中英

Simple upload ckeditor 5 cannot upload file: undefined

I'm using ckeditor 5 simple upload with laravel, however when I upload any image an alert with "localhost says Cannot upload file: undefined." I'm using the package below

https://github.com/shino47/ckeditor5-build-laravel-image

My js sample code looks like below:-

 $(document).ready(function() {
        var cb = function() { return (new Date()).getTime() }
        ClassicEditor.create(document.querySelector('#editor'), {
            simpleUpload: {
                uploadUrl: {
                    url: 'http://localhost/myendpoint'
                },
                headers: {
                    'X-CSRF-TOKEN': 'token',
                    'x-header-cb': cb
                }
            }
          }).then(editor => {
            console.log('Editor created successfully!');
          }).catch(err => {
            console.error(err.stack);
         });
      });
     

Also, does anyone know a way of finding out the error? There are no errors on the console.

您的服务器端点必须返回这样的 json:{ "uploaded": true, "url": "http://public/path/to/img" }

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM