codeslayer1 / react-ckeditor

CKEditor component for React with plugin and custom event listeners support
MIT License
129 stars 34 forks source link

Image upload from computer not working #56

Closed saurabh147sharma closed 6 years ago

saurabh147sharma commented 6 years ago

Here is my code which I used in react: <CKEditor activeClass="p10" content={props.content} config={{ allowedContent:true, filebrowserImageUploadUrl: 'http://localhost/core/upload.php' }} events={{ change: props.handleChange }} />

Request URL: http://localhost/core/upload.php?CKEditor=editor1&CKEditorFuncNum=1&langCode=en Here is my upload .php response

After pressing send to server button I got following error in console

Uncaught DOMException: Blocked a frame with origin "http://localhost" from accessing a cross-origin frame. at http://localhost/core/upload.php?CKEditor=editor1&CKEditorFuncNum=1&langCode=en:1:47

When I clicked Ok button I got error "Image source URL is missing"

codeslayer1 commented 6 years ago

This is not an issue with the package. Your browser is blocking cross origin request, hence the error. Download the CORS plugin for your browser and see if it works with the plugin enabled.

Else read about CORS on stackoverflow and follow the steps to correct it. Or try running your code on a hosted dev server.

Closing this issue since its unrelated to the package.

saurabh147sharma commented 6 years ago

I resolved CORS issue but still getting Image source URL is missing error. You should not close the issue like this. This is my ajax response: <script>window.parent.CKEDITOR.tools.callFunction(1, 'http://localhost/core/images/1.jpg', '1.jpg successfully uploaded: \n- Size: 75.97 KB');</script>

codeslayer1 commented 6 years ago

Issues are meant to be opened in case of actual issue with the package which is not the case here. You need to put in effort to debug and try to solve basic implementation issues. A simple google search puts up so many links to people facing the same problem (like here and steps to resolve it. Even in this package, many issues have been discussed regarding image upload which you can easily look up in closed issues and check where you are going wrong. You cannot expect others to fix up the code for you.

Even your last issue was due to a problem in your own code, and you didn't bother to close up the issue once you realised the problem. Plus you simply pasted the stack trace expecting us to figure out the problem. Please read up basic open source/github guidelines before posting.