Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

337
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda