title: Android Firebase upload image
body: <p>I tried to upload images to Firebase storage by using the below code:</p>
  
  <pre><code>    FirebaseStorage firebaseStorage = FirebaseStorage.getInstance();
      final StorageReference storageRef = firebaseStorage.getReferenceFromUrl("gs://xxx");
  
      Uri file = Uri.fromFile(new File(url));
      mStorageRef = storageRef.child("images/"+file.getLastPathSegment());
      UploadTask uploadTask = storageRef.putFile(file);
      uploadTask.addOnFailureListener(new OnFailureListener() {
          @Override
          public void onFailure(@NonNull Exception exception) {
              // Handle unsuccessful uploads
              Log.i(TAG, exception.toString());
          }
      }).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
          @Override
          public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
              // taskSnapshot.getMetadata() contains file metadata such as size, content-type, and download URL.
              Uri downloadUrl = taskSnapshot.getDownloadUrl();
          }
      });
  </code></pre>
  
  <p>However, I meet the below error:
  <code>
  E/StorageException: StorageException has occurred.
                      An unknown error occurred, please check the HTTP result code and inner exception for server response.
                       Code: -13000 HttpResult: 400
  E/StorageException: The server has terminated the upload session
                      java.io.IOException: The server has terminated the upload session
                          at com.google.firebase.storage.UploadTask.zzabc(Unknown Source)
                          at com.google.firebase.storage.UploadTask.zzabb(Unknown Source)
                          at com.google.firebase.storage.UploadTask.run(Unknown Source)
                          at com.google.firebase.storage.StorageTask$8.run(Unknown Source)
                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                          at java.lang.Thread.run(Thread.java:818)
  </code></p>
  
  <p>I found some people suggest updating the google play services on my phone. My phone has already have the latest version. I also tried enable anonymous sign in and make rules public.</p>
  
  <p>Are there any other suggestions?</p>