Answer the question
In order to leave comments, you need to log in
Is it possible to send the data along with the file to the server?
Hi all!
The question is, can I send any data with the file, the file is doing in FormData();
Backend - Node.js
Here is the service method:
public uploadAvatar(contactId, formData) {
const token = '2agicftcnrpnpvio0askksatt9yb3m0lapvyvw17mra0rg4x6r2b12787phkw75isslyqq90y66r';
const body = new URLSearchParams();
const headers = new Headers({'Content-Type': 'multipart/form-data'});
body.set('sessiontoken', token);
body.set('type', 'contacts');
body.set('identifier', contactId);
body.set('file', formData);
return this.http.post(`${this.API_URL}/files`, body, {headers: headers})
.map(response => response.json());
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question