mirror of https://github.com/4xmen/xshop.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.0 KiB
PHP
31 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\User;
|
|
use Illuminate\Http\Request;
|
|
|
|
class CkeditorController extends Controller
|
|
{
|
|
public function upload(Request $request)
|
|
{
|
|
if ($request->hasFile('upload')) {
|
|
$originName = $request->file('upload')->getClientOriginalName();
|
|
$fileName = pathinfo($originName, PATHINFO_FILENAME);
|
|
$extension = $request->file('upload')->getClientOriginalExtension();
|
|
$fileName = $fileName . '_' . time() . '.' . $extension;
|
|
|
|
$request->file('upload')->move(public_path('upload/images'), $fileName);
|
|
|
|
$CKEditorFuncNum = $request->input('CKEditorFuncNum');
|
|
$url = asset('/upload/images/' . $fileName);
|
|
$msg = __('Image uploaded successfully');
|
|
$response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>";
|
|
|
|
@header('Content-type: text/html; charset=utf-8');
|
|
echo $response;
|
|
}
|
|
}
|
|
}
|