Created
September 26, 2014 10:31
-
-
Save kamiyam/b48d477f900814101cd8 to your computer and use it in GitHub Desktop.
File Upload form data multiple for Angular
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
do(d=document)-> | |
app = angular.module myApp, [] | |
app.controller "uploadCtrl", ["$scope", "$http", ($scope, $http)-> | |
$scope.$data = { | |
userId: "ID" | |
userName: "USER_NAME" | |
userMail: "[email protected]" | |
receiveMail: "[email protected]" | |
downloadPassword: "hogehoge" | |
} | |
$scope.$fn = {} | |
$scope.$fn.fileUpload = ()-> | |
data = { | |
user_id: $scope.$data.userId | |
user_name: $scope.$data.userName | |
user_mail: $scope.$data.userMail | |
receive_mail: $scope.$data.receiveMail | |
download_password: $scope.$data.downloadPassword | |
} | |
fd = new FormData( angular.element("#form1")[0]); | |
$http({ | |
method: "POST" | |
url: "/file/upload" | |
data: fd | |
params: data | |
transformRequest: angular.identity | |
headers: {'Content-Type': undefined} | |
}) | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment