AmazonS3 putObject with InputStream length example

前端 未结 8 2043
梦如初夏
梦如初夏 2020-12-04 07:36

I am uploading a file to S3 using Java - this is what I got so far:

AmazonS3 s3 = new AmazonS3Client(new BasicAWSCredentials(\"XX\",\"YY\"));

List

        
相关标签:
8条回答
  • 2020-12-04 08:07

    I've created a library that uses multipart uploads in the background to avoid buffering everything in memory and also doesn't write to disk: https://github.com/alexmojaki/s3-stream-upload

    0 讨论(0)
  • 2020-12-04 08:07

    Just passing the file object to the putobject method worked for me. If you are getting a stream, try writing it to a temp file before passing it on to S3.

    amazonS3.putObject(bucketName, id,fileObject);
    

    I am using Aws SDK v1.11.414

    The answer at https://stackoverflow.com/a/35904801/2373449 helped me

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