lundi 5 mars 2018

Laravel: TinyMCE Upload Images

I want to upload images insinde the TinyMCE editor. I found instructions for that in the docs.

These are my Javascript settings:

tinymce.init({ 
       selector: '#about',          
       images_upload_url: '/home/profile/about/img',
     });

tinymce.activeEditor.uploadImages(function(success) {
      $.post('/home/profile/about/img', tinymce.activeEditor.getContent()).done(function() {
        console.log("Uploaded images and posted content as an ajax request.");
      });
    });

I created the following route to check if everything is setup correctly

Route::post('/home/profile/about/img', function(){
 return json_encode(['location' => '/storage/app/public/pictures/bestAvatar.png' ]);
});

I expected that when I upload an image nothing will be uploaded and the image bestAvatar.png is shown - however instead I get an error:

enter image description here

Am I missing anything? Is it maybe because there is no default csrf token in the tinymce ajax call?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2FW7QoN
via IFTTT

Aucun commentaire:

Enregistrer un commentaire