I need to convert a file to a byte array into my WebApi
my HTML template:
<input style="display: none" type="file" (change)="onFileChanged($event)" #fileInput>
<button (click)="fileInput.click()">Select File</button>
<button (click)="onUpload()">Upload!</button>
end my component:
onFileChanged(event) {
this.selectedFile = event.target.files[0]
}
onUpload() {
const uploadFile = new FormData();
uploadFile.append('string', this.selectedFile,
this.selectedFile.name);
this.http.post(URL ,uploadFile);
}
for this example not use service