不要序列
FormData与
POST荷兰国际集团服务器。做这个:
this.uploadFileToUrl = function(file, title, text, uploadUrl){ var payload = new FormData(); payload.append("title", title); payload.append('text', text); payload.append('file', file); return $http({ url: uploadUrl, method: 'POST', data: payload, //assign content-type as undefined, the browser //will assign the correct boundary for us headers: { 'Content-Type': undefined}, //prevents serializing payload. don't do it. transformRequest: angular.identity });}然后使用它:
MyService.uploadFileToUrl(file, title, text, uploadUrl).then(successCallback).catch(errorCallback);



