title: Android Image Upload to S3 happening from emulator and not from mobile
body: <p>I am building an android app that allows users to take pictures.  The pictures gets saved in <code>/files/Pictures</code> within the app.  I am using the following code to upload images:</p>
  
  <pre><code>public void uploadFileToS3() {
          String ACCESS_KEY = "";
          String SECRET_KEY = "";
          String MY_BUCKET="";
          BasicAWSCredentials credentials = new BasicAWSCredentials( ACCESS_KEY, SECRET_KEY );
          AmazonS3 s3 = new AmazonS3Client( credentials,Region.getRegion( Regions.AP_SOUTH_1 ) );
          java.security.Security.setProperty("networkaddress.cache.ttl" , "60");
          s3.setEndpoint( "https://s3-ap-south-1.amazonaws.com" );
          TransferUtility transferUtility = TransferUtility.builder().s3Client(s3).context(getApplicationContext()).build();
          File storageDir = getExternalFilesDir( Environment.DIRECTORY_PICTURES);
          String files[] = storageDir.list();
          int fileCount = storageDir.listFiles().length;
          for (int i=0;i&lt;=fileCount; i++) {
              File uploadToS3 = new File(files[i]);
              String file = files[i];
              TransferObserver transferObserver = transferUtility.upload( MY_BUCKET,file, uploadToS3);
              transferObserver.setTransferListener( new TransferListener() {
                  @Override
                  public void onStateChanged(int id, TransferState state) {
                      Toast.makeText( getApplicationContext(), "State Change:"+ state, Toast.LENGTH_SHORT ).show();
                  }
  
                  @Override
                  public void onProgressChanged(int id, long bytesCurrent, long bytesTotal) {
                      int percentage = (int) (bytesCurrent/bytesTotal*100);
                      Toast.makeText( getApplicationContext(), "Upload Status : "+percentage+"%", Toast.LENGTH_SHORT ).show();
                  }
  
                  @Override
                  public void onError(int id, Exception ex) {
                      Log.e("error","error");
                  }
              } );
          }
  
      }
  </code></pre>
  
  <p>The problem I am facing is i am not able to upload the images to s3.</p>
  
  <p><strong>Edit 1:</strong></p>
  
  <p>I changed my code to this:</p>
  
  <pre><code>File storageDir = getExternalFilesDir( Environment.DIRECTORY_PICTURES);
          String files[] = storageDir.list();
          int fileCount = storageDir.listFiles().length;
          for (int i=0;i&lt;=fileCount; i++) {
              String file = files[i];
              File uploadToS3 = new File(getApplicationContext().getFilesDir(),"Pictures/"+file);
              TransferObserver transferObserver = transferUtility.upload( MY_BUCKET,file, uploadToS3);
  </code></pre>
  
  <p>The rest remains the same.  I am getting the following message in the logcat:</p>
  
  <pre><code>Caused by: java.lang.IllegalArgumentException: Invalid file: /data/user/0/com.example.syncsqlite/files/Pictures/ra_surf_surentp_ShelfPara_20191229_175752_1301070086.jpg
  </code></pre>
  
  <p>followed by:</p>
  
  <pre><code>at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.upload(TransferUtility.java:564)
          at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.upload(TransferUtility.java:530)
          at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.upload(TransferUtility.java:499)
          at com.amazonaws.mobileconnectors.s3.transferutility.TransferUtility.upload(TransferUtility.java:443)
  </code></pre>