我正在建立一个个人网站,需要用户通过签名上传将文件上传到Cloudinary。我的代码是
const cloudinary = require('cloudinary/lib/cloudinary').v2;
cloudinary.config({
cloud_name: 'cloud_name',
api_key: 'api_key',
api_secret: 'api_secret'
});
cloudinary.uploader.upload(image,{public_id: id}, function(error, result) { });
[每当我运行cloudinary.uploader.upload时,我都会在浏览器中收到此错误
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.cloudinary.com/v1_1/cloud_name/image/upload. (Reason: header ‘user-agent’ is not allowed according to header ‘Access-Control-Allow-Headers’ from CORS preflight response).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.cloudinary.com/v1_1/cloud_name/image/upload. (Reason: CORS request did not succeed).
结帐[节点存储管理器] https://www.npmjs.com/package/node_storage_manager
它支持各种存储,例如s3存储桶,GCLOUD存储桶文件系统等
您可以轻松地在任何服务之间切换