@MEMELE - Hello, @memele!
Are you using Jquery or Vue?
There is a package for Vue called vue-trumbowyg. I've used Trumbowyg before, but I found TinyMCE a much better option.
FileFieldName means the key expected by your $request->file('key').
For example,
$path = $request->file('image')->store($dir);.
A simple store method in your controller for image uploads would look like this:
public function store(Request $request)
{
$dir = 'public/images';
$path = $request->file('image')->store($dir);
$name = str_replace("$dir/", '', $path);
$response = [
'success' => true,
'url' => asset("storage/images/" . $name)
];
return response()->json($response);
}
This will return a response to your front-end with "url" and "success". You actually don't need to store the path in the database, since it will be stored in the body as a img tag that includes the src attribute.
The docs for Trumbowyng says it expects a JSON response like that.
{
success: true, // Must be false if upload fails
url: 'https://example.com/myimage.jpg'
}
So, my suggestion should fit your needs. Take a look: https://alex-d.github.io/Trumbowyg/documentation/plugins/#plugin-upload
Also, make sure you have properly set your back-end API to receive this post request.
Hope this reply helps you. Let me know if so.