{"action":"closed","issue":{"url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1194","labels_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1194/labels{/name}","comments_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1194/comments","events_url":"https://api.github.com/repos/danialfarid/ng-file-upload/issues/1194/events","html_url":"https://github.com/danialfarid/ng-file-upload/issues/1194","id":121570121,"number":1194,"title":"data issue when uploading multiple files plus data for each file wrapped in a promise ","user":{"login":"BonnieBonfire","id":3276059,"avatar_url":"https://avatars.githubusercontent.com/u/3276059?v=3","gravatar_id":"","url":"https://api.github.com/users/BonnieBonfire","html_url":"https://github.com/BonnieBonfire","followers_url":"https://api.github.com/users/BonnieBonfire/followers","following_url":"https://api.github.com/users/BonnieBonfire/following{/other_user}","gists_url":"https://api.github.com/users/BonnieBonfire/gists{/gist_id}","starred_url":"https://api.github.com/users/BonnieBonfire/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BonnieBonfire/subscriptions","organizations_url":"https://api.github.com/users/BonnieBonfire/orgs","repos_url":"https://api.github.com/users/BonnieBonfire/repos","events_url":"https://api.github.com/users/BonnieBonfire/events{/privacy}","received_events_url":"https://api.github.com/users/BonnieBonfire/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-12-10T20:26:15Z","updated_at":"2015-12-11T15:22:39Z","closed_at":"2015-12-11T15:22:39Z","body":"I am uploading a set of files each of which have associated data in a loop. However the the request payload shows the data associated with the final file is being sent for each file. Can you help? Thank you.\r\n```\r\nvar deferred = $q.defer();\r\nif ($scope.fileData.data.length) {\r\n  for (var i = 0; i < $scope.fileData.data.length; i++) {\r\n    var file = $scope.fileData.data[i].file;\r\n    if (!file.$error) {\r\n      $scope.documentDTO.description = $scope.fileData.data[i].description;\r\n      Upload.upload({\r\n        url: '../document',\r\n        data: $scope.documentDTO,\r\n        file: file\r\n        }).then(function (resp) { ...});\r\n    }\r\n  }\r\n}\r\ndeferred.resolve();\r\nreturn deferred.promise;\r\n```\r\n"}}