unggahan file di posule 10 post
onFileSelected(event) {
if(event.target.files.length > 0)
{
this.myForm.patchValue({
fileName: event.target.files[0],
})
}
}
submit(){
const formData = new FormData();
formData.append('file', this.myForm.get('fileName').value);
this.http.post('http://localhost:3000/upload', formData)
.subscribe(res => {
console.log(res);
alert('Uploaded Successfully.');
})
}
Zany Zebra