Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upload Image #2

Open
bahadorfarahani opened this issue Nov 26, 2018 · 4 comments
Open

Upload Image #2

bahadorfarahani opened this issue Nov 26, 2018 · 4 comments

Comments

@bahadorfarahani
Copy link

Hi
How to upload new image in ckeditor to server?

@evtrw
Copy link

evtrw commented May 20, 2019

in config/admin.php file

    'extensions' => [
        'ckeditor' => [
            'enable' => true,
            'config' => [
                'filebrowserImageUploadUrl' => '/image/upload', // your url 
            ]
        ]
    ],

in your controller

public function upload(Request $request)
{
    $image = $request->file('upload'); // get file

    // response
    $param = [
            'uploaded' => 1,
            'fileName' => 'fileName',
            'url' => 'url'
    ];
    return response()->json($param, 200); 
}

@tom1097
Copy link

tom1097 commented Sep 28, 2020

can you teach me? I don't know how to use it...

in config/admin.php file

    'extensions' => [
        'ckeditor' => [
            'enable' => true,
            'config' => [
                'filebrowserImageUploadUrl' => '/image/upload', // your url 
            ]
        ]
    ],

in your controller

public function upload(Request $request)
{
    $image = $request->file('upload'); // get file

    // response
    $param = [
            'uploaded' => 1,
            'fileName' => 'fileName',
            'url' => 'url'
    ];
    return response()->json($param, 200); 
}

@doanvandoana8
Copy link

can you teach me? I don't know how to use it...

in config/admin.php file

    'extensions' => [
        'ckeditor' => [
            'enable' => true,
            'config' => [
                'filebrowserImageUploadUrl' => '/image/upload', // your url 
            ]
        ]
    ],

in your controller

public function upload(Request $request)
{
    $image = $request->file('upload'); // get file

    // response
    $param = [
            'uploaded' => 1,
            'fileName' => 'fileName',
            'url' => 'url'
    ];
    return response()->json($param, 200); 
}

/image/upload: This is your url to upload image file
Ex: Route::post('image/upload', 'AdminController@ckEditorUpload')->name('admin.ck-editor.upload');

After this line: $image = $request->file('upload'); // get file, You need to upload $image and save it your server. After that, you need to get url of $image(ex: http://app-drug-store.local/uploads/ckeditor-files/97497750_548110366098944_8383231890651348992_n_1607828477.jpg) and file name: ex: 97497750_548110366098944_8383231890651348992_n_1607828477.jpg. Finally, you need push variable to $pram and return response

@hoangnamitc
Copy link

My same Issues, but responsive 404 file not found

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants