I have used this library for angular2 file upload https://github.com/valor-software/ng2-file-upload
Now I'm getting this error when I upload a file
XMLHttpRequest cannot load http://localhost:8080/files. 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:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
Make withCredentials = false before uploading the item. You can put this code in ngOnInit/ constructor or ngOnChanges. 
this.uploader.onBeforeUploadItem = (item) => {
  item.withCredentials = false;
}
                        Your server is responding with the following CORS Header
'Access-Control-Allow-Credentials' = true
This is a security that CORS provide, you are not allowed to do that. You cannot use  Access-Control-Allow-Origin =  * if you what to allow credentials. You will have to specify the exact domain. try Specifying
localhost:<portnumber>
For more information look at the following links
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With