Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

336
Views
upload file should accepts XLS files only file size limit 5mb Angular 13

I need do upload file which accepts XLS files only file size limit 5mb Angular 13?

HTML

<input name="file" type="file" (change)="onSelectFile($event)" required/> <button type ="file"> </button>

Ts file

onSelectFile(event:any){
const allowed_type = ['application/xslx']
if (this.file.size >5000 * 1024 && this.files.type !== allowed_type) {
this.warning = true;     
 } else {
 this.warning = false; 
   }
}

here I can only get warning msg on size limit not file type

I need both the validations happen.

also tried in this way:

 if (this.file.size >5000 * 1024) {
    this.warning = true;     
     } else if (this.files.type !== allowed_type){
     this.warning = true; 
    }else{
this.warning = false;
}

Here I should not allow more 5mb and file type should accept only xsl format.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!