Currently I have an app where hen the user takes a picture it automatically gets saved in storage and then I save an url to the image in storage. But whenever I add new images it just changes the old one to the new one. I want to append new ones. The end goal is for a user to be able to save an array of images he took to firebase under his account.

Bellow is my code for saving the images a user takes:

```
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

        if let userPickedImage = info[UIImagePickerControllerOriginalImage] as? UIImage {

//            let imageToUse = PhotoArray()

//            let data = UIImagePNGRepresentation(userPickedImage) //here convert to data

            PhotoArray.sharedInstance.photosArray.append(userPickedImage)  //append converted data in array

            //                do {
            //                    try realm.write {
            //                        realm.add(imageToUse)
            //                    }
            //                } catch {
            //                    print(“error adding image to array\(error)“)
            //                }

            imageView.image = userPickedImage
//-----------------------------//
            //Create a reference to the image
            let imageRef = Storage.storage().reference().child("image.jpg")

            // Get image data
            if let uploadData = UIImagePNGRepresentation(userPickedImage) {

                // Upload image to Firebase Cloud Storage
                imageRef.putData(uploadData, metadata: nil) { (metadata, error) in
                    guard error == nil else {
                        // Handle error
                        return
                    }
                    // Get full image url
                    imageRef.downloadURL { (url, error) in
                        guard let downloadURL = url else {
                            // Handle error
                            return
                        }

                        // Save url to database
                        Firestore.firestore().collection("images").document("myImage").setData(["imageUrl" : downloadURL.absoluteString])
                    }
                }
            }
//-----------------------------//
        }
//        print(PhotoArray().photosArray.count)
        imagePicker.dismiss(animated: true, completion: nil)
    }

```