I'm using angular to send a request to server to add a picture
but when I log the formData, formData doesn't have anything, I've checked, file exists, file is not empty file exists but it doesn't append to formData
this is typescript file to set file in formData
sendPicture(event: any) {
const file = event.target.files[0];
const formData = new FormData();
formData.append('picture', file);
console.log(formData);
}
and here's what displays in the browser
You can try the following code for log formData
logs.
sendPicture(event: any) {
const file = event.target.files[0];
const formData = new FormData();
formData.append('picture', file);
console.log(formData.get('picture'));
}