存储在Amazon S3的Java的图片上传图片上传、Amazon、Java

2023-09-12 21:27:28 作者:匿名的关系

很难找到一些例子说明如何我可以使用Java允许用户上传图片到Amazon S3。

Having trouble finding some examples showing how I can use Java to allow users to upload an image to Amazon S3.

的流程是:

User是与文件输入表单元素的HTML表单。

User is on HTML form with file input form element.

本表所选图像提交给一个Servlet。

This form submits the selected image to a Servlet.

这个servlet处理图像,并将其存储在S3中。

This Servlet processes the image and stores it in S3.

任何人都知道任何好的链接/教程大纲样code来执行呢?

Anyone know of any good links/tutorials that outline sample code to perform this?

推荐答案

对于第三点:

抢的JetS3t

这是教程很简单。下面是我使用的一个片段: Grab jets3t

It's tutorial is simple. Here's a snippet I'm using:

S3Object fileObject = new S3Object(path);
fileObject.setDataInputStream(is);
s3service.putObject(bucketName, fileObject);

对于previous两点 - look在这个问题

For the previous two points - look at this question