2016-11-29 164 views
4

其实我需要在amazon s3服务器上同时上传多张图片。这里是我的单一文件上传代码在这里::如何在amazon webservice s3(Android)上同时上传多张图片?

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 
     ); 
+0

[使用PHP Web服务中上传多张图片]的可能的复制(http://stackoverflow.com/questions/27834733/uploading-multiple-images-in-webservice-using-php) – AlphaQ

+1

最后我得到了解决办法为multiupload android .am使用这种方法https://aws.amazon.com/blogs/developer/amazon-s3-transfermanager-batched-file-uploads/ –

回答

2

请检查出来!

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); 
0
+3

thankz yaar。最后我得到了解决方案multiupload android.am使用这种方法https://aws.amazon.com/blogs/developer/amazon-s3-transfermanager-batched-file-uploads/ –