本文介绍了ng2-file-upload访问控制源问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已将此库用于angular2文件上传 https://github.com/valor -software/ng2-file-upload
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
推荐答案
在上传项目之前,先创建withCredentials = false
.您可以将此代码放在ngOnInit
/constructor
或ngOnChanges
中.
Make withCredentials = false
before uploading the item. You can put this code in ngOnInit
/ constructor
or ngOnChanges
.
this.uploader.onBeforeUploadItem = (item) => {
item.withCredentials = false;
}
这篇关于ng2-file-upload访问控制源问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!