title: How return name of image from FormControl in ReactivForms
body: <p>I want to get the name from FormControl of the image in Angular ReactivForms. I got the full path of the image like <code>file = "C:\fakepath\Screenshot (1).png"</code> but I want only <code>Screenshot (1).png</code>.
  I using <code>control.value</code> for getting the name of the image.
  I want to add I do not have this folder in my C: directory <code>C:\fakepath\</code></p>
  
  <p>This is my method :</p>
  
  <pre><code> requiredFileType(categoryList: CategoryModel[]) {
      return function (control: FormControl) {
        const file = control.value;
        if (file) {
          const extension = file;
  
          for (let i = 0; i &lt; categoryList.length; i++) {
  
            for (let j = 0; j &lt; categoryList[i].productModel.length; j++) {
              for (let k = 0; k &lt; categoryList[i].productModel[j].imageProduct.length; k++) {
                console.log(categoryList[i].productModel[j].imageProduct[k].image_path);
                if (categoryList[i].productModel[j].imageProduct[k].image_path.includes(extension)) {
                  console.log(categoryList[i].productModel[j].imageProduct[k].image_path);
  
                  return{
                    requiredFileType: true
                  };
  
                }
              }
  
            }
  
          }
          return null;
  
        }
  
        return null;
  
      };
    }
  </code></pre>
  
  <p>Does anyone know the resolution of this?</p>