title: uploading an image to firebase storage fails
body: <p>I'm trying to upload an image from Gallery to Firebase Storage. </p>
  
  <p>Picking an Image from the Gallery works fine but then the selected Image is not being uploaded to Firebase Storage. </p>
  
  <p>I think the problem is with this module in my code which I'm not able to figure out. </p>
  
  <pre><code>if (requestCode == RC_PHOTO_PICKER &amp;&amp; resultCode == RESULT_OK) {
  
    Uri selectedImageUri = data.getData();
  
    // Get a reference to store file at photos/&lt;FILENAME&gt;
    StorageReference photoRef = mPhotosStorageReference.child(selectedImageUri.getLastPathSegment());
  
    //Upload file to Firebase Storage
    photoRef.putFile(selectedImageUri)
      .addOnSuccessListener(this, new OnSuccessListener &lt; UploadTask.TaskSnapshot &gt; () {
        @Override
        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  
          // When the image has successfully uploaded, we get its download URL
          @SuppressWarnings("VisibleForTests")
          Uri downloadUrl = taskSnapshot.getDownloadUrl();
  
          // Set the download URL to the message box, so that the user can send it to the database
          Message message = new Message(null, userName, downloadUrl.toString());
          messagesDatabaseReference.push().setValue(message);
        }
      });
  </code></pre>
  
  <p>I'm running my app on my mobile device Moto G4 (Android Nougat) through USB.</p>