[英]How to intergrate medium-editor-insert-plugin with laravel 5.5
I have been trying to upload images to my Medium-editor using the Medium-editor-insert-plugin with Laravel5.5 for days without success. 几天来,我一直在尝试使用带有Laravel5.5的Medium-editor-insert-plugin将图像上传到我的Medium-editor,但没有成功。
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.
我正在使用medium-editor-insert-plugin的最新发行版。
here is my javascript code to initiate the medium-insert-plugin: 这是我的JavaScript代码,用于启动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 但使用插件将图像插入编辑器后,我得到此错误
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.
一直在尝试编辑插件本身,但到目前为止没有办法。
您可能应该只返回数据对象属性。
{"files":[{}]}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.