Ramco Ramco

Ramco Ramco

  • 419
  • 3.4k
  • 528k

Property file does not exist on type 'Advance Component'

May 30 2024 5:43 AM

Hi

  In below code i am getting error

 <div class="col-3 text-end">
            <input type="file" class="btn btn-primary" (change)="uploadImage($event)">
        </div>

        <div class="row">
            <div class="col-3 text-end" @for (item of uploadedFileNames)>
                <img [src]="fileUrl + file" alt="">
            </div>
        </div>
uploadImage(event:any){
    debugger;
    const file = event.currentTarget.files[0];
    if(event.target.files.length > 0 ){
      if(file.type == 'image/png' || file.type == 'image/jpeg') {
      const formObj = new FormData();
      formObj.append('file',file);
      this.post('storeapi.gerasim.in/Customer/Upload',formObj).subscribe((res: any)=>{
        this.uploadedFileNames.push(res);
    });
  }
    }
  } 

Thanks


Answers (3)