1

Following this tutorial to Store Image path to Firebase Storage

Here is my code:

StorageReference storageReference = FirebaseStorage.getInstance().getReference();
String STORAGE_PATH_UPLOADS = "Profile Pictures/" + UID + "/" + imgID;
StorageReference sRef = storageReference.child(STORAGE_PATH_UPLOADS + "." + "jpg");

sRef.putFile(imgPath)
            .addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                @Override
                public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                    Toast.makeText(mContext, "uploaded successfully", Toast.LENGTH_SHORT).show();
                }
            })
            .addOnFailureListener(new OnFailureListener() {
                @Override
                public void onFailure(@NonNull Exception e) {
                    Toast.makeText(mContext, e.getMessage(), Toast.LENGTH_SHORT).show();
                }
            });

Exception:

StorageException: StorageException has occurred.
An unknown error occurred, please check the HTTP result code and inner exception for server response.
Code: -13000 HttpResult: 0

I searched on this but didn't get any solution

Shruti
  • 803
  • 9
  • 26
  • 1
    The exception you show misses the most important information, which is likely in the inner exception. Instead of showing a toast, log the entire exception with `Log.e("MYAPP", "exception", e);`. See https://stackoverflow.com/questions/4341363/android-print-full-exception-backtrace-to-log – Frank van Puffelen Sep 30 '17 at 13:22
  • as per link you have an image view,So are you see image when you try to upload image.because i got this error when image was null when trying to upload. so please first check image is null or not – Uttam Meerwal Sep 30 '17 at 13:27
  • @UttamMeerwal image is not null, it gets displayed in the ImageView. – Shruti Oct 03 '17 at 05:32
  • @FrankvanPuffelen Thanks for your comment. So it is `Caused by: java.io.FileNotFoundException: No content provider` – Shruti Oct 03 '17 at 05:58
  • 1
    The file you upload has to be on the local file system. It seems like Android doesn't recognize `imgPath` as a local file. Also see https://stackoverflow.com/search?q=%5Bfirebase%5D+%22No+content+provider%22 – Frank van Puffelen Oct 03 '17 at 13:06

0 Answers0