简体   繁体   English

亚马逊nodejs Aws-SDK S3 SignedUrl“回调”

[英]Amazon nodejs Aws-Sdk S3 signedUrl “callback”

At the moment, I develop a little image-uploader for my nodejs-webapp. 目前,我为我的nodejs-webapp开发了一个小图像上传器。 Every user has the right to upload 10 images(for example). 每个用户都有权上传10张图像(例如)。

The upload should be performed on the client side to reduce the server workload. 应该在客户端执行上载以减少服务器工作量。

For this reason, I generate a signed url on the server-side and send it to the client: 因此,我在服务器端生成一个签名的URL并将其发送给客户端:

let request:S3.PutObjectRequest = {
   Key:filename,
   Bucket: "image-proxy",
   Expires:new Date(20000),
   ContentType:"jpg",ACL:"public-read" 
}
this.s3.getSignedUrl("putObject",request,cb);

This works well, but how can I control the max of 10 Images and the general status of the upload? 效果很好,但是如何控制最多10张图像和上传的一般状态? One possibility would be to send a callback from the client to the server, after the upload is completed. 一种可能性是在上传完成之后,将回调从客户端发送到服务器。

But "never trust the client", what if a "hacker" block this callback. 但是“永远不要信任客户端”,如果“黑客”阻止了此回调该怎么办。

Is it possible, to get a callback server-side from the "putObject", after the upload is finished? 上传完成后,是否可以从“ putObject”获取回调服务器端?

Thanks. 谢谢。

Micheal had the solution: Micheal有解决方案:

AmazonS3 NotificationHowTo AmazonS3 NotificationHowTo

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM