2016-11-29 196 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/ –