hi i want to upload multiple file and send them to a server: using reactive form
this.attachmentsForm = this.formBuilder.group({
attachmentName: ['']
});
<form [formGroup]="attachmentsForm">
<ion-item>
<ion-label floating>
Attachment Name
</ion-label>
<ion-input type="text" formControlName="attachmentName"></ion-input>
</ion-item>
<input class="form-control" #fileInput type='file' (change)="fileChanged($event)">
</form>
fileChanged(event) {
if (event.target.files && event.target.files[0]) {
if (event.target.files[0].size > 512000) {
this.fileValid = false;
let toast = this.toastCtrl.create({
message: 'the file size more than 500kb',
duration: 3000
});
toast.present();
} else {
this.fileValid = true;
}
}
}