In my angular4 application I'm trying to upload the video to server. But no matter what i add to the content type it always results in error from the server. In angular 1 the same api is hit using { 'Content-Type': undefined }
i tried the same in angular but it dint work. The data and everything is correct. I have tried with content-type set as below
headers.append('Content-Type', 'multipart/form-data');
headers.append('Authorization', token);
headers.set('Accept', 'application/json');
and also as below
headers.append('Content-Type', undefined);
below is the http request method:
public uploadVideo(formData: any) {
var Upload = this.baseUrl + this.ngAuth.getApiUrl('Upload');
var authData = JSON.parse(this.localStorage.localStorageGet('token'));
var token = 'Bearer ' + authData.token;
var self = this;
var headers = new Headers();
headers.append('Content-Type', 'multipart/form-data');
headers.append('Authorization', token);
headers.set('Accept', 'application/json');
return this.http.post(Upload , formData, { headers: headers, method: 'POST' })
.map((res: Response) => res.json());
}
Please guide! Thanks