使用预签名的URL方法将文件从浏览器(javascript)上传到Spaces帐户。它已被阻止
Access to XMLHttpRequest at 'https://my/signed/url' from origin 'http://192.168.1.233:8000' has been blocked by CORS policy: Response to the preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
XMLHttpRequest
var blob = new Blob([e.target.files[0]], {type: e.target.files[0].type});
var xhr = new XMLHttpRequest();
xhr.open('PUT', data.upload_url);
xhr.send(blob);
console.log(xhr.status)
更新了Spaces设置中的CORS配置(主机,最大年龄和允许的方法),但仍然引发CORS标头问题。我实际上在这里想念的是什么。在python请求中也是如此,
Python请求:
with open(archive_file, 'rb') as data:
response = requests.put(signed_uri, data=data)
从$.ajax()
作为文件索引发送甚至失败。谁能建议我如何从javascript
上载而不使用nodejs
或react