uploadFile(fileToSend: File) : Observable<boolean> {
const url = "your url";
const formData: FormData = new FormData();
formData.append('file', fileToSend, fileToSend.name);
//Notice that there is no header
return this.httpClient.post<boolean>(url, formData);
}
Upload a File through API
Assuming we are calling a api post route with 'file' argument passing through [FromForm]
and returning a boolean value (success/failure)
Assuming we are calling a api post route with 'file' argument passing through [FromForm]
and returning a boolean value (success/failure)
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.