laravel jodit 编辑器中的自定义图像上传选项

问题描述 投票:0回答:1

我正在 Laravel 框架中编写

editor
并实现
Jodit
库。 我想为 editor 添加 upload。问题是 upload 不适用于 editor。我的代码如下。

我的路线

Route::prefix('')->namespace('Web')->name('')->group(function() {
    Route::post('/upload', 'UploadController@index' )->name('index');
});

我的UploadController.php

class UploadController extends Controller
{
    public function index(Request $request)
    {
        $file = $request->file('file');
        $file->move( storage_path('uploads') , imagetrim($file->getClientOriginalName()) );
    }
}

我的刀片:

<textarea name="content" class="editor"></textarea>

我的js:

var editor = new Jodit('.editor', {
    textIcons: false,
    iframe: false,
    iframeStyle: '*,.jodit_wysiwyg {color:red;}',
    height: 800 ,
    defaultMode: Jodit.MODE_WYSIWYG,
    observer: {
        timeout: 100
    },
    commandToHotkeys: {
        'openreplacedialog': 'ctrl+p'
    },
    uploader: {
        url: '/upload'
    },
    });
});

错误控制台:

1. Uncaught (in promise) TypeError: resp is undefined.
2. Post : http://127.0.0.1:8000/upload :> Status: 500 Internal Server Error

但是我没有得到好的结果,我无法上传,并且照片没有上传到文件夹

storage/uploads
。它说
resp
未定义,您需要添加它。我应该输入什么代码才能上传(
resp
)?

请帮忙。

laravel upload jodit
1个回答
0
投票

如果你想使用文件管理器或其他功能,你必须购买它。因为它是付费节目。

© www.soinside.com 2019 - 2024. All rights reserved.