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));
Controller
<?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
Route::post('image/upload', 'ImagesController@upload')->name('image.upload');
sudo chmod -R 777 public/uploads/ckeditor/
не катит...