Sid*_*art 9 ckeditor laravel-5.6
当我按下发送时,服务器收到此错误 Incorrect Server Response
这是我的控制器
public function mediauploadpost(Request $request){
$CKEditor = $request->input('CKEditor');
$funcNum = $request->input('CKEditorFuncNum');
$message = $url = '';
if (Input::hasFile('upload')) {
$file = Input::file('upload');
if ($file->isValid()) {
$filename =rand(1000,9999).$file->getClientOriginalName();
$file->move(public_path().'/wysiwyg/', $filename);
$url = url('wysiwyg/' . $filename);
} else {
$message = 'An error occurred while uploading the file.';
}
} else {
$message = 'No file uploaded.';
}
return '<script>window.parent.CKEDITOR.tools.callFunction('.$funcNum.', "'.$url.'", "'.$message.'")</script>';
}
Run Code Online (Sandbox Code Playgroud)
Dis*_*oat 16
我最近遇到了同样的问题,解决方案是将此行添加到我的ckeditor-config.js文件中:
config.filebrowserUploadMethod = 'form';
Run Code Online (Sandbox Code Playgroud)
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7131 次 |
| 最近记录: |