Firebase storage - Limit size of image that users upload to firebase storage
<p>I am a new firebase developer. I am developing an android app that lets users upload images to firebase storage. Because I am using Spark mode I only have 5Gb of storage.
I want to limit the size of images that users upload to firebase storage.
Below is the code that I use to upload an image to firebase storage.</p>

<pre><code>Uri imageUri = Uri.parse(imagePath);
                    //need permistion android.permission.MANAGE_DOCUMENTS to upload file.
                    final StorageReference photoRef = mStorageRef.child(Constants.FIREBASE_LOCATION_IMAGE_EXAM).child(imageUri.getLastPathSegment());
                    taskStarted();
                    photoRef.putFile(imageUri).addOnSuccessListener(new OnSuccessListener&lt;UploadTask.TaskSnapshot&gt;() {
                        @Override
                        public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {
                            Log.d(TAG, "upload success");
                            mUploadExamTaskCount--;
                            examURLArray.add(new ExamPage(taskSnapshot.getDownloadUrl().toString()));
                            if (mUploadExamTaskCount == 0) {//upload files success.
                                /**
                                 * update image link to database.
                                 */
                                DatabaseReference firebaseExamPage = FirebaseDatabase.getInstance().getReference(Constants.FIREBASE_LOCATION_EXAM_PAGE);
                                firebaseExamPage.child(examKey).setValue(examURLArray);
                                Log.d(TAG, "send upload  exam success br");
                                Intent taskCompletedIntent = new Intent(ACTION_UPLOAD_EXAM_COMPLETED);
                                LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(taskCompletedIntent);
                            }
                            taskCompleted();
                        }
                    })
</code></pre>

<p>Do you have any idea how to resolve this problem ?</p>