簡體   English   中英

使用AWS Amplify將文件上傳到S3時獲取上傳進度的狀態

[英]Get status of upload progress while uploading files to S3 using AWS Amplify

我正在使用aws-amplify sdk通過angular將文件上傳到S3,我想看看有多少文件已上傳到存儲桶。

Storage.put(id, name)
    .then (result => console.log(result))
    .catch(err => console.log(err)).on('httpUploadProgress', function(progress) {
    // Here you can use `this.body` to determine which file this particular
    // event is related to and use that info to calculate overall progress.
});

這是行不通的,我似乎無法找到解決方案。

可以獲取Storage API的上傳進度(aws-amplify)。 但是它仍然沒有在官方文檔中記錄

嘗試這個

Storage.put(id, name, {
  progressCallback(progress) {
    console.log(`Uploaded percentage: ${progress.loaded}/${progress.total}`);
  },
});

擴增出的文檔現在包括本- https://aws-amplify.github.io/docs/js/storage#put

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM