0

so i've tried to upload an image to firestore, but it gives me the error Unsupported operation: _Namespace. Here's my method:

File pickedImage;
  Future<Uri> uploadPic() async {
    FirebaseStorage _storage = FirebaseStorage.instance;

    StorageReference reference = _storage.ref().child("profile_pictures/");

    StorageUploadTask uploadTask = reference.putFile(pickedImage);

    Uri dowurl = await (await uploadTask.onComplete).ref.getDownloadURL();

    return dowurl; 
  }

1 Answer 1

1

Try adding a name to the file you want to save:

StorageReference reference = _storage.ref().child("profile_pictures/ –add Name here –");

You might also remove the / that comes after profile_pictures, if you don‘t want to add another reference

Sign up to request clarification or add additional context in comments.

2 Comments

Do I have to write the extension in the name? "profile_pictures/test.png" or just "profile_pictures/test" ?
@AlexandreMercier no, you don't have to use '.png' at the end of the file name. Firebase is managing that for you.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.