Blame view
app/Http/Controllers/CKEditorController.php
1.14 KB
5b2dcf44b Редактор страниц ... |
1 2 3 4 5 |
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; |
dd87a3ce4 Реклама-блок, обн... |
6 |
use Illuminate\Support\Facades\Storage; |
5b2dcf44b Редактор страниц ... |
7 8 9 10 11 12 |
class CKEditorController extends Controller { public function upload(Request $request) { if($request->hasFile('upload')) { |
dd87a3ce4 Реклама-блок, обн... |
13 |
/*$originName = $request->file('upload')->getClientOriginalName(); |
5b2dcf44b Редактор страниц ... |
14 15 16 17 18 |
$fileName = pathinfo($originName, PATHINFO_FILENAME); $extension = $request->file('upload')->getClientOriginalExtension(); $fileName = $fileName.'_'.time().'.'.$extension; $request->file('upload')->move(public_path('images'), $fileName); $CKEditorFuncNum = $request->input('CKEditorFuncNum'); |
dd87a3ce4 Реклама-блок, обн... |
19 20 21 |
$url = asset('images/'.$fileName); */ $CKEditorFuncNum = $request->input('CKEditorFuncNum'); $url = asset(Storage::url($request->file('upload')->store('pages', 'public'))); |
5b2dcf44b Редактор страниц ... |
22 23 24 25 26 27 28 29 |
$msg = 'Image successfully uploaded'; $response = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>"; @header('Content-type: text/html; charset=utf-8'); echo $response; } } } |