Limit number of files in a firebase storage path
I want to limit the number of files that a user can upload to a firebase storage path. Here is my firebase storage rule: service firebase.storage { match /b/jobsdbn.appspot.com/o { match /images/Business/{userId}/{imageId} { allow read allow write: if request.auth.uid == userId && (request.resource == null || ( (list(/images/Business/$(username)).size() <= 5) && imageId.size() < 50 && request.resource.size < 10 * 1024 * 1024 && request.resource.contentType.matches('image/.*'))) } } } I have added list(/images/Business/$(username)).size() <= 5 from this article: https://groups.google.com/forum/