0
            $scope.uploadFiles = function () {
             //debugger;
            var request = {
                method: 'POST',
                url: 'http://localhost/upload/',
                data: formdata,
                headers: {
                    'Content-Type': undefined
                }
            };

            // SEND THE FILES.
            $http(request)
                .success(function (d) {
                    alert(d);
                })
                .error(function () {
                });
        }

i am getting in console window like XMLHttpRequest cannot load http://localhost/upload/. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:55555' is therefore not allowed access. The response had HTTP status code 405.

1

1 Answer 1

0

If I understand this correctly, the app is running at http://localhost:55555 and you are trying to send a POST request to http://localhost/upload/ (which really means http://localhost:80/upload/). Your browser is not allowing you to do this since http://localhost:80/ and http://localhost:55555/ are different origins.

Perhaps you meant to say http://localhost:55555/upload/? This would solve your issue.

Otherwise you need to disable CORS in your browser or add the 'Access-Control-Allow-Origin: * header in your server at http://localhost:80/.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks....i tried localhost:55555/upload also but getting same issue.i will try 'Access-Control-Allow-Origin: * otherwise i need write in services to upload images using C# or i should use some upload.php to move.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.