1

I have followed this link When i check response in my code

 imageUploaded(image:any){
      var headers = new Headers();
      headers.append('Content-Type','multipart/form-data')
      headers.append('Authorization',this.token);
      let formData: FormData = new FormData();
      formData.append('image', image.file);
  this.http.post(this.serverUrl+'photo/upload/user/'+this.userJson.user.public_id,formData, { headers: headers})
        .subscribe(
            response => {
                if(response.json().error_code == 0){
                alert('done')

                }else{
                    this.data = {};
                }
            }
        )
 }

When I verified my API with live the only differance I found in network is the content type For working API-----Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryl4oxlVSt9yblG8VC For me -----Content-Type:multipart/form-data

I am missing the boundary with content type.Can anyone please help me.Thanks.

Suraj Rao
  • 28,186
  • 10
  • 88
  • 94
Tracker
  • 305
  • 1
  • 3
  • 9
  • If you want to use the boundary, just add it? `headers.append('Content-Type','multipart/form-data; boundary=----WebKitFormBoundaryl4oxlVSt9yblG8VC')` – Fredrik Lundin Mar 31 '17 at 07:22
  • HiFredrik,how can I get the value for boundary? – Tracker Mar 31 '17 at 07:31
  • As far as I understand it, it's just a delimiter of your data parts, so it can basically by anything that will not appear in your data stream. Take a look at this answer: http://stackoverflow.com/a/20321259/2521893, or this: http://stackoverflow.com/a/2071407/2521893 – Fredrik Lundin Mar 31 '17 at 07:35

0 Answers0