[英]Uploading a file to S3 with angular + aws-sdk-js + pre-signed url
I would like to use a pre-signed url with the aws-sdk-js and I can't find anywhere an example, is it possible to do something like this? 我想在aws-sdk-js中使用预签名的url,但在任何地方都找不到示例,可以这样做吗?
var bucket = new AWS.S3({uri: preSignedUrl}); <== ??
var params = {Key: 'my.key', Body: file};
bucket.upload(params, function (err, data) {
...
});
Thanks for your help :) 谢谢你的帮助 :)
If you have been given a presigned url, you don't actually need to use the AWS JavaScript SDK to use it. 如果为您提供了一个预签名的URL,则实际上不需要使用AWS JavaScript SDK来使用它。
In nodejs, for example, you could use the request module to upload a file using a presigned url. 例如,在nodejs中,您可以使用请求模块使用预先签名的url上载文件。 Example: 例:
request({
url: presignedUrl,
method: 'PUT',
body: FILE
});
Noticed you're using Angular. 注意您正在使用Angular。 You could accomplish the same using an AJAX call as well. 您也可以使用AJAX调用来完成相同操作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.