Ionic3 multipart/form-data

Hi, I’m using ionic3 with HttpClientModule.

I have tryied many ways with no success, see my code:

private postDocuments(url: string, category: string, image: any, mimeType: string): Observable<{}> {
const encoded : string = btoa(this.PUBLISHABLE_KEY + ‘:’);
const fileName: string = + ‘.’ + mimeType;
const file : any = new Blob([name=${fileName};${image}], {type: image/${mimeType}});
const headers : HttpHeaders = new HttpHeaders()
.set(‘Content-Type’, ‘multipart/form-data;boundary=—011000010111000001101001’)
.set(‘Authorization’, Basic ${encoded})
.set(‘Accept’, ‘application/json’);
const fd : FormData = new FormData();
fd.append(‘category’, category);
fd.append(‘file’, file, fileName);
return, fd, { headers });

And receive:

“error”:{“error”:{“status”:“Bad Request”,“status_code”:400,“type”:“invalid_request_error”,“category”:“missing_required_param”,“message”:“Missing required param: file. Please verify request parameters.”}}}

Can someone help me?

Thanks in advanced.