Cannot Submit FormData


#1

I am trying to submit formdata but still it doesn’t work. I am not sure what is going wrong…

       let url = AppSettings.API_ENDPOINT + 'chatPostDirectMessage';
		let headers = new Headers();
        headers.append('Content-Type', 'multipart/form-data');

        let body = new FormData();
        body.append('receieverId', receieverId);
        body.append('text', text);
        if(attachment) {
            body.append('attachment', attachment);
        }

		return this.http.post(url, body, {
            headers: headers
        })
        .map(res => {
            return res.json();
        }).catch(this.handleError);

#2

FormData is not supported at this moment, use nativescript-background-http plugin for file uploads.


#3

Alright. i thought it was…


#4

Eventually i created my own plugin to do so. Here is it on github https://github.com/dotnetdreamer/nativescript-http-formdata