我在 laravel 中使用 CKEditor 实现图像上传,但图像已上传但未显示。我需要帮助,请。
这些是我的代码
public function upload(Request $request){
if($request->hasFile('upload')){
$originalName=$request->file('upload')->getClientOriginalName();
$fileName=pathinfo($originalName,PATHINFO_FILENAME);
$extension=$request->file('upload')->getClientOriginalExtension();
$fileName=$fileName.'_'.time().'.'.$extension;
$request->file('upload')->move(public_path('images'),$fileName);
$CKEditorFuncNum=$request->input('CKEditorFuncNum');
$url=asset('public/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;
}
}
输出是这个