upload image to ckeditor in laravel Incorrect server response
i am trying to upload image through ckeditor 4
when i press send it the server
getting this Error Incorrect Server Response
here is my controller
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>';
}
ckeditor laravel-5.6
add a comment |
i am trying to upload image through ckeditor 4
when i press send it the server
getting this Error Incorrect Server Response
here is my controller
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>';
}
ckeditor laravel-5.6
add a comment |
i am trying to upload image through ckeditor 4
when i press send it the server
getting this Error Incorrect Server Response
here is my controller
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>';
}
ckeditor laravel-5.6
i am trying to upload image through ckeditor 4
when i press send it the server
getting this Error Incorrect Server Response
here is my controller
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>';
}
ckeditor laravel-5.6
ckeditor laravel-5.6
asked Aug 17 '18 at 9:45
Sid HeartSid Heart
318318
318318
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
I had this same issue recently, and the solution was to add this line to my ckeditor-config.js
file:
config.filebrowserUploadMethod = 'form';
add a comment |
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found$CKEditor = $request->input('CKEditor');
and$funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this
– Sid Heart
Aug 18 '18 at 10:58
add a comment |
If you are using java as your backend server: return string response:
"{n " +
" "uploaded": 1,n" +
" "fileName": "foo.jpg",n" +
" "url": "/files/foo.jpg"n" +
"}"
See this link fro more information.
Also remember to to have annotation: produces = MediaType.TEXT_HTML_VALUE
over your rest API.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51892652%2fupload-image-to-ckeditor-in-laravel-incorrect-server-response%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
I had this same issue recently, and the solution was to add this line to my ckeditor-config.js
file:
config.filebrowserUploadMethod = 'form';
add a comment |
I had this same issue recently, and the solution was to add this line to my ckeditor-config.js
file:
config.filebrowserUploadMethod = 'form';
add a comment |
I had this same issue recently, and the solution was to add this line to my ckeditor-config.js
file:
config.filebrowserUploadMethod = 'form';
I had this same issue recently, and the solution was to add this line to my ckeditor-config.js
file:
config.filebrowserUploadMethod = 'form';
answered Nov 12 '18 at 16:47
DisgruntledGoatDisgruntledGoat
40.6k56176263
40.6k56176263
add a comment |
add a comment |
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found$CKEditor = $request->input('CKEditor');
and$funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this
– Sid Heart
Aug 18 '18 at 10:58
add a comment |
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found$CKEditor = $request->input('CKEditor');
and$funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this
– Sid Heart
Aug 18 '18 at 10:58
add a comment |
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
$res = "<script>window.parent.CKEDITOR.tools.callFunction(" .$funcNum. "," . $url . "," .$message. ")</script>"
return response()->json(['data' => $res]);
edited Aug 17 '18 at 18:01
answered Aug 17 '18 at 17:52
Tornike MenabdeTornike Menabde
11
11
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found$CKEditor = $request->input('CKEditor');
and$funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this
– Sid Heart
Aug 18 '18 at 10:58
add a comment |
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found$CKEditor = $request->input('CKEditor');
and$funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this
– Sid Heart
Aug 18 '18 at 10:58
1
1
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
While this may solve the question, a more comprehensive answer would be to explain what the error was and how this solution fixes that.
– Ross
Aug 17 '18 at 18:40
1
1
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.
– 31piy
Aug 18 '18 at 5:20
Thanks for replying me but its not working i found
$CKEditor = $request->input('CKEditor');
and $funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this– Sid Heart
Aug 18 '18 at 10:58
Thanks for replying me but its not working i found
$CKEditor = $request->input('CKEditor');
and $funcNum = $request->input('CKEditorFuncNum');
both request coming null how to fix this– Sid Heart
Aug 18 '18 at 10:58
add a comment |
If you are using java as your backend server: return string response:
"{n " +
" "uploaded": 1,n" +
" "fileName": "foo.jpg",n" +
" "url": "/files/foo.jpg"n" +
"}"
See this link fro more information.
Also remember to to have annotation: produces = MediaType.TEXT_HTML_VALUE
over your rest API.
add a comment |
If you are using java as your backend server: return string response:
"{n " +
" "uploaded": 1,n" +
" "fileName": "foo.jpg",n" +
" "url": "/files/foo.jpg"n" +
"}"
See this link fro more information.
Also remember to to have annotation: produces = MediaType.TEXT_HTML_VALUE
over your rest API.
add a comment |
If you are using java as your backend server: return string response:
"{n " +
" "uploaded": 1,n" +
" "fileName": "foo.jpg",n" +
" "url": "/files/foo.jpg"n" +
"}"
See this link fro more information.
Also remember to to have annotation: produces = MediaType.TEXT_HTML_VALUE
over your rest API.
If you are using java as your backend server: return string response:
"{n " +
" "uploaded": 1,n" +
" "fileName": "foo.jpg",n" +
" "url": "/files/foo.jpg"n" +
"}"
See this link fro more information.
Also remember to to have annotation: produces = MediaType.TEXT_HTML_VALUE
over your rest API.
answered Sep 19 '18 at 13:58
Suvriti GandhiSuvriti Gandhi
556
556
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f51892652%2fupload-image-to-ckeditor-in-laravel-incorrect-server-response%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown