title: Uploading PDF files to Firebase
body: <p>I am uploading PDF files from my phone storage to firebase storage.
  There is an EditText view for adding name and uploading it to firebase database. I just want to show the URL of firebase storage Download Url and this name in firebase database. Below is the code kindly guide me what is missing. Code for name and URL. And the code is in kotlin language. </p>
  
  <p>Upload() is a class object</p>
  
  <pre><code> val upload = Upload(txtPdfName.text.toString().trim(), taskSnapshot?.downloadUrl.toString().trim())
  
  val uploadId = mDatabaseRef.push().key
  mDatabaseRef.child(uploadId).setValue(upload)
  </code></pre>
  
  <p>Here is the code for Upload Class.</p>
  
  <pre><code>class Upload(toString: String, toString1: String) {
      var name : String = ""
      var url : String = ""
  
  
  
      companion object {
          fun getName(upload: Upload): String {
              return upload.name
          }
          fun getUrl(upload: Upload): String{
              return upload.url
          }
      }
  
      fun Upload(name: String, url: String) {
          this.name = name
          this.url = url
      }
  
  
  }
  </code></pre>
  
  <p>And here is the database picture where name and URL values are empty.</p>
  
  <p><a href="https://i.stack.imgur.com/bFXRs.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bFXRs.png" alt="enter image description here"></a></p>
  
  <p>Alex Mamo here is the function I am using.</p>
  
  <pre><code> fun upload_Files(view: View) {
          if (true) {
              val dialoq = ProgressDialog(this)
              dialoq.setTitle("File is Uploading")
              dialoq.show()
  
              val ref = mStorageRef.child(FB_STORAGE_PATH + System.currentTimeMillis() + "." + getImageTxt(uripdf))
              try {
                  ref.putFile(uripdf).addOnSuccessListener { taskSnapshot: UploadTask.TaskSnapshot? -&gt;
                      dialoq.dismiss()
                      Toast.makeText(this, "Successfully Uploaded :)", Toast.LENGTH_LONG).show()
                      val upload = Upload(txtPdfName.text.toString().trim(), taskSnapshot?.downloadUrl.toString().trim())
  
                      val uploadId = mDatabaseRef.push().key
                      mDatabaseRef.child(uploadId).setValue(upload)
  
                   Log.i("Data",upload.toString())
                  }
  </code></pre>