0
我正在構建圖像服務器。有一個接受圖像的servlet,目的是將圖像存儲在Amazon S3中。如何將圖像傳輸到Amazon S3
Part filePart = request.getPart("file");
InputStream inputStream = filePart.getInputStream();
如何流內容到Amazon S3,而無需下載文件到二級存儲?
亞馬遜S3 API是
System.out.println("Uploading a new object to S3 from a file\n");
File file = new File(uploadFileName);
s3client.putObject(new PutObjectRequest(
bucketName, keyName, file));
但是這需要一些文件路徑本地存儲。如何將圖像從servlet直接傳輸到S3而不將其存儲在磁盤上?