Answer the question
In order to leave comments, you need to log in
Problem with uploading image to CKEditor 5 server?
var elementId = "desc_comp";
ClassicEditor
.create(document.getElementById(elementId), {
toolbar: ['bold', 'italic', 'bulletedList', 'numberedList', '|', 'link', '|', 'imageUpload', '|', 'undo', 'redo'],
ckfinder: {
uploadUrl: 'uploads/ckeditor',
options: {
resourceType: 'Images',
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
}
}
})
.then(editor => {
editor[elementId] = editor;
})
.catch(err => console.error(err.stack));
<?php
namespace App\Http\Controllers\Administrator;
use App\Http\Controllers\Controller;
class ImagesController extends Controller
{
public function upload(Request $request){
$path = $request->file('image')->store("uploads", 'public');
return response()->json(array(
'file' => url('/storage/'. $path),
'success' => 1,
'status' => 200,
));
}
}
Route::post('image/upload', '[email protected]')->name('image.upload');
Answer the question
In order to leave comments, you need to log in
Ckeditor makes a GET request.
And the route says Route:: post ('image/upload', '[email protected]')->name('image.upload');
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question