froala / angular-froala

Angular.js bindings for Froala WYSIWYG HTML Rich Text Editor.
https://froala.com/wysiwyg-editor
MIT License
306 stars 123 forks source link

Unable to upload images to own server #141

Closed sandeep-purma closed 7 years ago

sandeep-purma commented 7 years ago

we are using "angular-froala": "2.3.1" , and Getting the following error for imageUpload

" *XMLHttpRequest cannot load http://localhost:8080/talent-wagon/api/v0/media?mediafor=statement&id=1. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '' when the request's credentials mode is 'include'. Origin 'http://localhost:9000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.** "

froala options configured as follows in controller

$scope.froalaOptions = { toolbarButtons: ["bold", "italic", "underline", "|", "align", "formatOL", "formatUL", "codePanel", "insertImage", "insertLink"], height: 200, html:{ 'get': function(){ console.log("here") } }, imageUploadURL: AppConfig.API_URL + 'media?mediafor=statement&id=' + $scope.challengeId, imageUploadMethod: 'POST' };

stefanneculai commented 7 years ago

@sandeep-purma that is because on the remote server where you're uploading the image, you should enable CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS.

stefanneculai commented 7 years ago

@sandeep-purma that is because on the remote server where you're uploading the image, you should enable CORS: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS.