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

323
Vistas
How to display list of uploaded files and how to remove it in angular

I am working on file upload component and I want to display the file name list and it should be removable. How to get the file name list in array?

async onUpload(event:Event){
const filesToUpload=(event.target as HTMLInput Element).files; // here I can able to get the 
//file names. but don't know how to set that in array
}

and each file should have x symbol(to remove the file). After uploaded the file we can remove it if we don't want it by using the x symbol. How to remove that?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Step 1) Make an API call to your backend to get a collection of files already available, return the relevant data as needed (ex: Filename, URL to where it is stored so that you can download it, whatever else is needed).

Step 2) Add some sot of click listener to whatever element the user clicks (be it a div or a button) to upload said file.

Ex: (in this example I am using Angular Material Table, but the concept is the same if you just an ngFor)

<mat-table #table [dataSource]="tableData" id="reportsRequestedTable">
     <button type="button" mat-icon-button (click)="delete(row)"><mat-icon 
         class="gray">clear</mat-icon></button>

In your delete method you will set its parameter as so:

delete(row: YourFileType) {
 //do whatever it is you need to do to delete the file from both front end and backend

Step 3) As far as upload goes; this doc has a good explanation of how to do it. https://blog.angular-university.io/angular-file-upload/ your upload method signature would like so:

async onUpload(event: Change)
about 4 years ago · Juan Pablo Isaza Denunciar
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