2016-10-07 4 views
0

내가하려는 것은 이미지를 내 AWS에 업로드하는 것입니다.아마존 서버에 이미지 업로드 중 오류가 발생했습니다.

보내기 버튼을 클릭하면 'uploadData'메서드가 활성화됩니다.

  1. 내 네트워크는 안정적입니다.하지만 내 업로드는 항상 실패합니다.
  2. 내 Amazon 구성에 문제가 없습니다 (연결 오류없이 과도한 발전기 데이터베이스가 있습니다.)
  3. 인터넷 권한이 이미 내 매니페스트에 포함되어 있습니다.

createUserFileManager 또는 uploadContent에 내 매개 변수가 문제가 있거나 내 인증 프로세스가 있다고 생각합니다. 확실하지 않습니다.

도와주세요.

내 uploadData 메소드는 다음과 같습니다.

public void uploadData(String path) { 
    final String filepath=path; 
    AWSMobileClient.initializeMobileClientIfNecessary(this); 
    AWSMobileClient.defaultMobileClient() 
      .createUserFileManager(AMAZON_S3_USER_FILES_BUCKET, null ,AMAZON_S3_USER_FILES_BUCKET_REGION, new UserFileManager.BuilderResultHandler() { 

       @Override 
       public void onComplete(final UserFileManager userFileManager) { 
        File file = new File(filepath); 
        userFileManager.uploadContent(file,"/public/new folder/" + file.getName(), new ContentProgressListener() { 

         @Override 
         public void onSuccess(final ContentItem contentItem) { 
          Log.d(LOG_TAG, filepath); 
          finish(); 
          // Handle successful action here 
         } 

         @Override 
         public void onProgressUpdate(final String fileName, final boolean isWaiting, 
                final long bytesCurrent, final long bytesTotal) { 

         } 

         @Override 
         public void onError(final String fileName, final Exception ex) { 
          Log.d(LOG_TAG, "upload failed"); 
          // Handle error case here 
         } 
        }); 
       } 
      }); 
} 

다음은 내 logcat입니다.

10-07 18:22:23.804 32219-32219/com.example.idolschool D/AWSMobileClient: AWS Mobile Client is OK 
10-07 18:22:23.844 32219-32219/com.example.idolschool D/TransferSerivce: Starting Transfer Service 
10-07 18:22:23.854 32219-32219/com.example.idolschool D/TransferSerivce: Network connected: true 
10-07 18:22:23.854 32219-14188/com.example.idolschool D/TransferSerivce: Loading transfers from database 
10-07 18:22:23.854 32219-14188/com.example.idolschool D/TransferSerivce: 0 transfers are loaded from database 
10-07 18:22:23.884 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:23.884 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:25.154 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:25.154 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:25.784 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:25.784 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:26.474 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:26.474 32219-14189/com.example.idolschool I/System.out: (HTTPLog)-Static: isSBSettingEnabled false 
10-07 18:22:26.904 32219-14189/com.example.idolschool E/UploadTask: Failed to upload: 20 due to Unable to execute HTTP request: Write error: ssl=0x7f94269100: I/O error during system call, Connection reset by peer 
10-07 18:22:26.904 32219-32219/com.example.idolschool D/Application: upload failed 
10-07 18:23:23.914 32219-14188/com.example.idolschool D/TransferSerivce: Stop self 

내 질문에 감사드립니다! 내 문제를 해결하기위한 모든 코드 요청을 환영합니다!

답변

0

null이 된 createUserFileManager의 IAM 구성 및 매개 변수를 "public /"로 조정하여이 문제를 해결했습니다.

관련 문제