title: How to upload file to Stream.io for activity posts and profile pictures
body: <p>I'm currently working on a community feature in my android app and I'm using the java CloudClient which has been working well. However I'm running into a roadblock when it comes to uploading images to Stream.io. I'm attempting to have the user upload pictures to their gallery in their phones and have them be uploaded. Below is the gallery access code. (written in Kotlin)</p>
  
  <pre><code>private fun openGalleryForImage() {
          val intent = Intent(Intent.ACTION_PICK)
          intent.type = "image/*"
          startActivityForResult(intent, REQUEST_CODE)
      }
  
      override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
          super.onActivityResult(requestCode, resultCode, data)
          if (resultCode == Activity.RESULT_OK &amp;&amp; requestCode == REQUEST_CODE){
              postImageIV.setImageURI(data?.data) // handle chosen image
              image = data?.data //image is the Uri
          }
      }
  </code></pre>
  
  <p>After getting the data I then attempt to upload the image using the following code (written in Java)</p>
  
  <pre><code>private static URL uploadImage(Uri imageUri) throws StreamException, MalformedURLException {
         CloudClient client = CloudClient.builder(apiKey, token, userID).build();
  
         String path = imageUri.getPath();
         File imageFile = new File(path).getAbsoluteFile();
         URL imageURL = null;
  
         try {
              imageURL = client.images().upload(imageFile).join();
         }catch(Exception M){
             Exception error = M;
             System.out.print(error);
         }
         return imageURL;
     }
  </code></pre>
  
  <p>Though when I run this section <strong>client.images().upload(imageFile).join();</strong> it comes back with "No file to upload" which I believe is a result of the following code in CloudClient's upload method:</p>
  
  <pre><code>checkArgument(imageFile.exists(), "No file to upload");
  </code></pre>
  
  <p>Am I going about uploading images to Stream.io in the wrong way?</p>