In my html I have:
name="file" type="file"
accept=".csv"
In ts:
I get file - $event.target.files.item(0);
Then I pass it to the service
uploadCSVFile( file) {
const uploadedFile = new FormData();
uploadedFile.append( 'file', file, file.name);
const url = `MyURL`;
return this.http.post(url, uploadedFile);
}
The problem is that it says File must have a contentType text/csv But when I add headers -
{headers: new HttpHeaders().append('Content-Type', 'text/csv')}
It is complaining that request is not multipart.
Username; Identifier;First name;Last name