Hi,
Hi I am trying to attach a file in formData , attaching file by uploading input type=file is working fine
But in my scenario I am having static file in assets folder so whenever Im trying to post api formData should have file: attachment in order to get access. I am trying on this more than a day still I couldn’t fix this issue.Please someone assist on this.Thanks in advance
let formData = new FormData();
formData.append('file','../../../../../assets/file.txt');
this.http.post(this.parameter, formData).subscribe(event => {
});
this returns null in formData and seems no attachment happens with this
and another way,
var request = new XMLHttpRequest();
request.open('POST', '../../../../../assets/file.txt', true);
request.send(formData);
this returns 404 not found even though path is correct.