<button type="button" (click)="fileInput.click()"
style="background-color: lightseagreen;width: 159px;color: black;border-radius: 15px;">Choose
File</button>
<input #fileInput type="file" id="file" (change)="setFilename(fileInput.files)" hidden />
<label>{{ filename }}</label>
setFilename(files) {
this.documentService.setFile("File");
if (files[0]) {
this.filename = files[0].name;
}
}
onSubmit(files) {
if (this.attachmentType == "") {
this.notificationService.showMessage(AlertMessageType.Error, AppConstant.selectAttachmentType);
return;
}
const formData = new FormData();
if (files[0]) {
formData.append(files[0].name, files[0]);
formData.append("memberId", this.memberEnrollmentHeaderId.toString());
formData.append("attachmentType", this.attachmentType);
}
this.documentService.OtherFileUpload(formData).subscribe({
next: (res) => {
this.OECFileProcessModel = res;
this.notificationService.showMessage(AlertMessageType.Success, AppConstant.attachmentUploadSuccess);
this.attachmentDataList = this.Documents;
this.UploadedFiles = [];
this.Documents = [];
this.getAttchmentList();
}, error: (err) => {
this.notificationService.showMessage(AlertMessageType.Error, AppConstant.fileUploadError);
}
});
}
}