hi james can you show an example on this ?i am currently working on something on play 2.1 and and angular 1.2.4 and i am able to send the file but play doesnt seem to handle it.heres the angular code i use form this jsfiddle http://jsfiddle.net/JeJenny/Z49N4/ thanks
On Saturday, April 12, 2014 at 4:55:56 PM UTC+2, James Morgan wrote: > > 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 "Angular and AngularJS discussion" 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 https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
