June 2018
Beginner to intermediate
394 pages
9h 2m
English
This technique uses the putFile() method of the storage reference instance to upload a local file. In its method parameters, we need to post the URI of the file to upload. For example, consider the following example:
Uri file = Uri.fromFile(new File("path/to/pictures/Ashok.jpg"));StorageReference riversRef = storageRef.child("pictures/"+file.getLastPathSegment());uploadTask = riversRef.putFile(file);uploadTask.addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception exception) { // Handle unsuccessful uploads }}).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() { @Override public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) { // We can use this ...
Read now
Unlock full access