浏览器访问是可以获取数据的,但是uni.uploadFile上传图片时跨域,..has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.
- 发布:2019-06-20 16:05
- 更新:2021-06-01 14:23
- 阅读:8537
1***@163.com - 一个平凡的码农
如果是php的话,可以用路由允许跨域解决:
Route::rule('upload',"file/fileUpload")->allowCrossDomain();
深海智行 - 专注前端培训
找你们后端,配置一下跨域
-
回复 p***@163.com: 你好,能问下怎么解决的吗?我后台设置了Access-Control-Allow-Origin但还是会报跨域的错误,后台还需要配置什么
2019-07-12 12:55
-
回复 1***@qq.com: 看看这个吧https://blog.csdn.net/marswill/article/details/82877069
2019-07-12 15:45
andylc
Route::any('api/upload_photo','webApi/UtilController/uploadPhoto')->allowCrossDomain(); 搞定
2021-12-30 20:49