Static File append in formdata to http post angular 7


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');, formData).subscribe(event => {

this returns null in formData and seems no attachment happens with this
and another way,

var request = new XMLHttpRequest();'POST', '../../../../../assets/file.txt', true);

this returns 404 not found even though path is correct.

It seems like you are trying to make an http request to the local file system which isn’t going to work. You will either need to set up a server route to handle the request, or since (i’m assuming) you are using Meteor, you could use a Meteor method call to accomplish this.

Thanks for the reply @copleykj ., I am trying to attach a local assets file in formData in order to hit my api request. How to create Meteor method for this ? Do we have any way in angular file handling?