i am using play framework 2.2 and angularjs to handle multipart/form-data,
but i have problem with my play framework cannot get multipart form
here my code :
> # //listen for the file selected event
>
> $scope.$on 'fileSelected', (event, args) ->
>
> $scope.$apply(() ->
>
> $scope.taxonomyfile = args.file
>
> )
>
> # //the save method
>
> $scope.save = () ->
>
> $http({
>
> method: 'POST',
>
> url: '/xbrl/report',
>
> headers: {
>
> 'Content-Type': false
>
> },
>
> data : {report: $scope.report},
>
> file : $scope.file,
>
> transformRequest: (data)->
>
> formData = new FormData()
>
> formData.append 'report',angular.toJson(data.report)
>
> formData.append 'taxonomyfile', data.taxonomyfile
>
> formData
>
> }).
>
> success((data, status, headers, config)->
>
> console.log 'success'
>
> ).
>
> error((data, status, headers, config) ->
>
> console.log('error')
>
> )
>
> my controller on play framework :
> @BodyParser.Of(BodyParser.MultipartFormData.class)
> public static Result save() {
> System.out.println(request().body());
> Http.MultipartFormData multipartFormData =
> request().body().asMultipartFormData();
> System.out.println(multipartFormData==null); // its always return
> null value <<<<<< the request body is raw
> return TODO;
> }
anyone ever use play + angular upload file? please help me :(
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.