How do I use post to upload files with other parameters in an ionic project?

there is a problem encountered in the ionic project. You need to upload a file through the API post, and two parameters can be adjusted on postman, but you don"t know how to write it in the ionic project. If anyone encounters a similar problem, try to crack the method.
the picture shows the effect of successful upload on postman:

Apr.27,2021

  constructor(
    public http: HttpClient) {} 
  
  public test():Observable<any> {
   let form = new FormData();
    form.append('id',id);
    form.append('type',type);
    form.append('file',file);

    return this.http.post(URL,form)
  }
    

in fact, you can click the code button in postman. If there is a code example, you can almost know it by looking at the code example of javascript.

clipboard.png


Content-TypeAccessToken

clipboard.png

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9dee8-1998.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9dee8-1998.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?