سلام
میخوام از ویرایشگر ckeditor عکس آپلود کنم منتها خطا میده ابتدا alert میده با پیام Incorrect server response.
لاگ هم پیام زیر رو میده
ckeditor.js:21 [CKEDITOR] Error code: filetools-response-error. {responseText: "<script>window .parent.CKEDITOR.tools.callFunction(1,'/uploads/subjects/6.jpg','')</script>"}
(anonymous) @ ckeditor.js:21
p @ ckeditor.js:10
(anonymous) @ ckeditor.js:12
CKEDITOR.warn @ ckeditor.js:19
(anonymous) @ ckeditor.js:869
p @ ckeditor.js:10
(anonymous) @ ckeditor.js:12
CKEDITOR.editor.CKEDITOR.editor.fire @ ckeditor.js:13
d.onload @ ckeditor.js:873
load (async)
attachRequestListeners @ ckeditor.js:872
upload @ ckeditor.js:871
(anonymous) @ ckeditor.js:870
a.<computed> @ ckeditor.js:11
p @ ckeditor.js:10
(anonymous) @ ckeditor.js:12
changeStatus @ ckeditor.js:874
c.onload @ ckeditor.js:871
load (async)
load @ ckeditor.js:871
loadAndUpload @ ckeditor.js:870
e.onClick @ ckeditor.js:880
c.onClick @ ckeditor.js:558
(anonymous) @ ckeditor.js:562
p @ ckeditor.js:10
(anonymous) @ ckeditor.js:12
click @ ckeditor.js:561
(anonymous) @ ckeditor.js:553
p @ ckeditor.js:10
(anonymous) @ ckeditor.js:12
(anonymous) @ ckeditor.js:68
ckeditor.js:21 [CKEDITOR] For more information about this error go to https://ckeditor.com/docs/ckeditor4/latest/guide/dev_errors.html#filetools-response-error
اینجوری من آپلود میکنم
public function uploadImage()
{
$this->validate(request(), [
'upload' => 'mimes:jpeg,jpg,gif,png'
]);
$file = request()->file('upload');
$filename = $file->getClientOriginalName();
$year = Carbon::now()->year;
$imagePath = "/uploads/{$year}/";
if (file_exists(public_path($imagePath) . $filename)) {
$filename = Carbon::now()->timestamp . '.' . $filename;
}
$file->move(public_path() . $imagePath, $filename);
$url = $imagePath . $filename;
return "<script>window.parent.CKEDITOR.tools.callFunction(1,'{$url}','')</script>";
}
و
<script>
$(function () {
CKEDITOR.replace('description', {
filebrowserUploadUrl:'/admin/upload',
filebrowserImageUploadUrl:'/admin/upload'
});
});
</script>
@juza66
من هم تقریبا از این کد استفاده میکنم منتها مشکل اینجاست تا دکمه send to server رو میزنم یه alert با متن Incorrect server response.میاد.
خب این خطا میگه رسپانسی از سمت سرور دریافت نمیشه، چک کن روت و کنترلر رو یا اینجا کدهات رو بذار ببینیم
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟