dotphp

uploadService.js

Apr 11th, 2016
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.service('multipartForm', ['$http', function($http){
  2.         this.post = function(uploadUrl, data){
  3.             var fd = new FormData();
  4.             for(var key in data)
  5.                 fd.append(key, data[key]);
  6.             $http.post(uploadUrl, fd, {
  7.                 transformRequest: angular.identity,
  8.                 headers:{'Content-Type': undefined}
  9.             })
  10.             .success(function(){
  11.                 console.log('success');
  12.             })
  13.             .error(function(){
  14.                 console.log('error');
  15.             });
  16.         }
  17.     }]);
Advertisement
Add Comment
Please, Sign In to add comment