Hi,
I need to upload the xml file to server. Backend is Java. Iam trying to
post data with formdata and headers but xml is not uploding to backend.
Please help.
*Component file:*
openFile(event) {
let fileList: FileList = event.target.files;
let headers = new Headers();
if (fileList.length > 0) {
let file: File = fileList[0];
let formData: FormData = new FormData();
formData.append('uploadFile', file, file.name);
this.http.post('http://localhost:8082/upload',formData,headers:
{
'Content-Type': undefined
})
.subscribe(res =>
console.log("data submitted>>>>>>",res)
);
}
}
*HTML File : *
<input type="file" [(ngModel)]="uploadFile" accept=".xml" name="uploadFile"
(change)='openFile($event)' />
Regards,
Venu
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.