其实我需要在亚马逊s3服务器上同时上传多张图片.这是我的单文件上传代码::
TransferObserver transferObserver = transferUtility.upload(
"selfiesharedev", /* The bucket to upload to */
mini_image_path, /* The key for the uploaded object */
file, /* The file where the data to upload exists */
CannedAccessControlList.PublicRead
);
最佳答案 请检查一下!
TransferManager tm = new TransferManager(myCredentials);
ObjectMetadataProvider metadataProvider = new ObjectMetadataProvider() {
void provideObjectMetadata(File file, ObjectMetadata metadata) {
// If this file is a JPEG, then parse some additional info
// from the EXIF metadata to store in the object metadata
if (isJPEG(file)) {
metadata.addUserMetadata("original-image-date",
parseExifImageDate(file));
}
}
}
MultipleFileUpload upload = tm.uploadFileList(
myBucket, myKeyPrefix, rootDirectory, fileList, metadataProvider);