将图像上传到Firebase存储会出现异常

时间:2017-09-30 09:47:41

标签: android firebase firebase-storage

按照this教程将图像路径存储到 Firebase存储

这是我的代码:

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();
                }
            });

例外:

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

我搜索了这个,但没有得到任何解决方案

0 个答案:

没有答案