I want to post Image File with other form details as one object as below
export interface Employee {
id: Guid;
firstName: string;
lastName: string;
email: string;
imgFile: File;
enteredDate: Date;
}
This is my service
addEmployee(employee: Employee) {
return this.http.post(this.baseUrl + 'employees/add', employee);
}
Is it possible to send a File as above ? If possible How to retrieve that file in asp.net core web api ?
[HttpPost("add")]
public void Add(EmployeeAddDto employeeAddDto)
{
....// save employeeAddDto object to database
}
in EmployeeAddDto what should be the file of imgFile ?
FormDatacheck this post-formdata