1

I have been trying to upload images to my Medium-editor using the Medium-editor-insert-plugin with Laravel5.5 for days without success.

To me it seems like the image is to passing to the sever and I don't know why. I am using the latest release version of medium-editor-insert-plugin.

here is my javascript code to initiate the medium-insert-plugin:

$(function () {
    $('.body-editable').mediumInsert({
        editor: bodyEditor,
         addons: {
            images: { 
                fileUploadOptions: {
                    url: 'upload',
                }
            }
        }
    });
});

and the route to send the request to the back-end look like this.

// upload image route for MediumInsert plugin
Route::post('upload', 'PostsController@upload');

and inside my controller i am return all the request data like this:

public function upload(Request $request)
    {
        return array('data:'=> $request->all());
        $upload_handler = new UploadHandler(array(
            //'upload_dir' => public_path().'uploads/',
            'upload_dir' => 'uploads/',
            'upload_url' => 'posts/upload/',
        ));

    }

but after use the plugin to insert an image to the editor i am get this error

error from the console

But in my network response i am getting this.

{"data:":{"files":[{}]}}

Please can someone tell me what to do? have been trying to edited the plugin itself but no way till now.

tony pro
  • 405
  • 3
  • 12

1 Answers1

0

You should probably return only the data object property.

{"files":[{}]}
chikeozulumba
  • 21
  • 1
  • 2