I have an input file upload type which is designed as below image.
When I upload the file the upload document label is getting overridden by fileName as shown in the below image.
What I want to do is when I upload an image, dynamically I want to create one more input file type and render on UI to upload a different file again when I click on 2nd input file which is created dynamically, and upload the file a 3rd input tag should be created when I click on 3rd and upload the 4th tag should be created and this goes on. On all tags, the upload documents label should be overridden by fileName once the file is uploaded.
This is in angular 8+. Any help would be appreciated. Note: Input File type multiple is not allowed. ALl the input types should be editable where users can re-upload files.
Below is the HTML code
<div class="row" style="margin-bottom: 10px;">
<input type="file" class="otherDocumentsUpload" (change)="onFileSelected($event)" #fileUpload>
<button mat-mini-fab class="upload-btn" (click)="fileUpload.click()">
<span>
<img src="assets/image/upload-icon.png" width="15px" height="16px" style="margin-right: 5px;"></span>
{{uploadedFile5 === '' ? 'Upload Document' : uploadedFile5}}</button>
<div class="file-upload" style="padding-left: 10px;">
{{fileName}}
</div>
</div>
CSS code
.otherDocumentsUpload{
display: none;
}
.upload-btn{
color: #999999;
font-family: Muli;
font-size: 16px;
text-align: left;
border: 1px dashed #b7b3b3;
border-radius: 4px;
height: 48px;
background: #fff !important;
cursor: pointer;
display: flex;
justify-content: space-between;
text-align: center !important;
margin-left: 13px;
width: 30%;
}
.file-upload{
width: 30%;
}
.labelUploadDocuments{
color: #000000;
font-family: Muli;
font-size: 14px;
line-height: 16px;
text-align: left;
font-weight: 700;
}
so simply consider as I've uploaded a file one more file upload option is rendered where I can upload a different file. I've uploaded into 2nd option one more file upload is rendered. and this goes on.