Hi Tanshu,

To the Java controller if I have to pass FormData. then How the FormData is 
mapped.
Can you provide any sample code using spring.

Regards,
Nalin
On Friday, 30 November 2012 11:43:17 UTC-6, [email protected] wrote:
>
> Hi,
> I didn't know which thread to post this in, so I decided to create a new 
> one in case it helps someone.  I have managed to achieve file uploading 
> using $http in angular 1.0.1, cannot confirm in other versions.  Here it 
> goes,
> 1. Add the file input box
>
>> <input type="file" id="uploadFile" ng-model="upFile" 
>> onchange="angular.element(this).scope().setFile(this)" />
>
> 2. Create the setFile method in the controller
>
>>     $scope.setFile = function (element) {
>
>         $scope.uploadedFile = element.files[0];
>
>     }
>
> 3. Upload in your function using:
>
>>     $scope.uploadFile = function () {
>
>         if (!$scope.uploadedFile) {
>
>             return;
>>
>         }
>
>         var fd = new FormData();
>
>         fd.append("uploadedFile", $scope.uploadedFile);
>
>         $http
>
>             .post(url, fd, {
>
>                 headers:{
>
>                     'Content-Type':undefined
>
>                 },
>
>                 transformRequest:angular.identity
>
>             });
>
>     };
>
>  
>
>
> I got all the info from searching on the net and the forums, so thanks to 
> all you guys.
> tanshu
>

-- 
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