AmazonS3 putObject with InputStream length example

前端 未结 8 2046
梦如初夏
梦如初夏 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条回答
  •  -上瘾入骨i
    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

提交回复
热议问题