title: Image is failed to upload in Firebase storage
body: <p>Can you please help me, I am trying to upload an image in FirebaseStorage.
  But it fails. </p>
  
  <p>My Button click Method</p>
  
  <pre><code>public void uploadImage(View view){
      Intent intent = new Intent(Intent.ACTION_PICK);
      intent.setType("image/*");
      startActivityForResult(intent,GALLERY_INTENT);
  }
  </code></pre>
  
  <p>And here is onActivityResult()</p>
  
  <pre><code>   protected void onActivityResult(int requestCode, int resultCode, Intent data) {
      super.onActivityResult(requestCode, resultCode, data);
      progressDialog.setMessage("Uploading");
      progressDialog.show();
      if(requestCode ==GALLERY_INTENT){
          final Uri uri = data.getData();
          StorageReference filepath = storageReference.child("Photos").child(uri.getLastPathSegment());
          filepath.putFile(uri).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
              @Override
              public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
  
                  Toast.makeText(getApplicationContext(),"Uploaded Successfully",Toast.LENGTH_LONG).show();
                 // profileImage.setImageURI(uri);
                  progressDialog.dismiss();
              }
          });
      }
  }
  </code></pre>
  
  <p>What's wrong with this code?</p>