mehrabt's avatar

Upload image with Ck Editor(v5) and Laravel

How Can I Upload Image With Ck Editor (V5) in Laravel? I think it has a package but I couldn't install it.

here is my code: create.blade.php:

@extends('layouts.app')
@section('content')
    <form action="{{route('ck.store')}}" method="post">
        @csrf
        <textarea id="editor" name="body">
            Here goes the initial content of the editor.
        </textarea>
        <button type="submit" class="btn btn-primary btn-sm">Submit</button>
    </form>
@endsection
<script src="{{asset('assets/js/ckeditor.js')}}"></script>
<script src="{{asset('assets/js/script.js')}}"></script>

my controller:

    public function store(Request $request)
    {
        $ck=Ck::create([
            'body' => $request->body,
        ]);
        return redirect()->route('ck.index');
    }

script.src:

    ClassicEditor
        .create( document.querySelector( '#editor' ) )
        .then( editor => {
            console.log( editor );
        } )
        .catch( error => {
            console.error( error );
        } );

0 likes
5 replies
mehrabt's avatar

I still could not solve this problem

siangboon's avatar

as my understand, textarea input is for text only, does not handle file or image, usually use the filemanager to upload and store the link at textarea...

1 like
mehrabt's avatar

@siangboon Yes but its not simple input, its ckEditor Do you know how can i Enable this Feature???

Please or to participate in this conversation.