Yes we have successfully got play 2 and angularjs file upload working. 

We use this angularjs module, we dont done anything fancy other use it in a 
basic fashion to upload 
files. https://github.com/danialfarid/angular-file-upload

We handle it play side in the same way the example gives 
here: http://www.playframework.com/documentation/2.0/JavaFileUpload

A cotcha I've had with play file uploads is the default size limit is 
small, This can be changed in the conf, a stackoverflow posts details it 
here: 
http://stackoverflow.com/questions/11327499/max-file-upload-size-in-play-framework-2-0

Hope this helps. 

On Saturday, 12 April 2014 04:51:57 UTC+1, Adil Ramdan wrote:
>
>  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.

Reply via email to