how to upload same name file to amazon s3 and overwrite exist file

前端 未结 2 2053
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-05 11:01
    s3.putObject({
        Bucket: bucketName,
        Key: fileName,
        Body: file,
        ACL: \'bucket-owner-full-control\'
    }, function(err, data) {
      i         


        
相关标签:
2条回答
  • 2021-02-05 11:40

    I guess you've encountered the default caching mechanism which is 24 hours, this results in not receiving the latest stored object. To override this, add parameter to putObject():

    CacheControl: "no-cache" or Expires: new Date()

    0 讨论(0)
  • 2021-02-05 11:52

    By default, when you upload the file with same name. It will overwrite the existing file. In case you want to have the previous file available, you need to enable versioning in the bucket.

    0 讨论(0)
提交回复
热议问题