title: I can't upload images into Firebase Storage in Kotlin
body: <pre><code>imageUpload.setOnClickListener {
          if (ContextCompat.checkSelfPermission(requireContext(),android.Manifest.permission.READ_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED){
              if (ActivityCompat.shouldShowRequestPermissionRationale(requireActivity(),android.Manifest.permission.READ_EXTERNAL_STORAGE)){
                  Snackbar.make(view,&quot;Galeriye erişmek için izin vermeniz gerekmektedir.&quot;,Snackbar.LENGTH_INDEFINITE).setAction(&quot;İzin Ver&quot;){
                      permissionLauncher.launch(android.Manifest.permission.READ_EXTERNAL_STORAGE)
                  }.show()
              }else{
                  permissionLauncher.launch(android.Manifest.permission.READ_EXTERNAL_STORAGE)
              }
          }else{
              val intentToGallery = Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
              activityResultLauncher.launch(intentToGallery)
          }
  
          val uuid = UUID.randomUUID()
          val imageName = &quot;$uuid.jpg&quot;
  
          val reference = storage.reference
          val imageReference = reference.child(&quot;images&quot;).child(imageName)
  
          if (selectedPicture!=null){
              imageReference.putFile(selectedPicture!!).addOnSuccessListener {
                  val uploadPictureReference = storage.reference.child(&quot;images&quot;).child(imageName)
                  uploadPictureReference.downloadUrl.addOnSuccessListener {
                      val downloadUrl = it.toString()
  
                      val profileMap = hashMapOf&lt;String, Any&gt;()
                      profileMap.put(&quot;downloadUrl&quot;,downloadUrl)
  
                      firestore.collection(&quot;Profile&quot;).add(profileMap).addOnSuccessListener {
                          
                      }.addOnFailureListener {
                          Toast.makeText(requireContext(),it.localizedMessage,Toast.LENGTH_SHORT).show()
                      }
                  }
  
              }.addOnFailureListener {
                  Toast.makeText(requireContext(),it.localizedMessage,Toast.LENGTH_SHORT).show()
              }
          }
      }
      forgotPassword.setOnClickListener {
          val action = ProfileFragmentDirections.actionProfileFragmentToForgotPassword2()
          Navigation.findNavController(it).navigate(action)
      }
  }
  
  
  
  private fun registerLauncher(){
      activityResultLauncher = registerForActivityResult(ActivityResultContracts.StartActivityForResult()){result -&gt;
          if (result.resultCode == RESULT_OK){
              val intentFromResult = result.data
              if (intentFromResult !=null){
                  selectedPicture = intentFromResult.data
                  selectedPicture?.let {
                      binding.selectImage.setImageURI(it)
                  }
              }
          }
      }
      permissionLauncher = registerForActivityResult(ActivityResultContracts.RequestPermission()){result-&gt;
          if (result){
              val intentToGallery = Intent(Intent.ACTION_PICK,MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
              activityResultLauncher.launch(intentToGallery)
          }else{
              Toast.makeText(requireContext(),&quot;Galeriye Erişim İçin İzin Gereklidir.&quot;, Toast.LENGTH_SHORT).show()
          }
      }
  </code></pre>
  <p>I am able to show the permissions while uploading the image. I can see Toast, snackbar messages depending on whether I give permission or not. I am able to upload the photo at first. However, since this photo I uploaded is not saved in the storage, when I change the page, the profile photo becomes old. So it doesn't add the new photo I saved. I'm trying to upload a photo in a Fragment.</p>