title: spring RESTcontroller to accept dataURI
body: <p>I am running into a issue of using angularjs ng-img-crop and Spring-boot REST web service.I want to upload an image file from ng crop to my backend web service.</p>
  
  <p>I tried writing a spring controller but it failed and  I couldnt find a good tutorial for this. help me resolve this basic request. </p>
  
  <p>Thanks !!!</p>
  
  <p><strong>app.js</strong></p>
  
  <pre><code>angular.module('myApp', [
                           'ngRoute',
                           'myApp.view1',
                           'myApp.view2',
                           'myApp.version',
                           'ngImgCrop'
                           ])
                           .controller('Ctrl',['$scope','notify', function($scope,notify) {
                               $scope.myImage='';
                               $scope.myCroppedImage='';
  
                               var handleFileSelect=function(evt) {
                                   var file=evt.currentTarget.files[0];
                                   var reader = new FileReader();
                                   reader.onload = function (evt) {
                                       $scope.$apply(function($scope){
                                           $scope.myImage=evt.target.result;
                                       });
                                   };
                                   reader.readAsDataURL(file);
                               };
                               angular.element(document.querySelector('#fileInput')).on('change',handleFileSelect);
                               $scope.submit=function() {
                                   notify($scope.myCroppedImage);
                               };
                           }]).
                           factory('notify',['$http', function($http) { 
                                 return function(myCroppedImage) {
                                     var name = 'vishnu';
                                     $http.post('http://localhost:8080/imageUpload', myCroppedImage)
                                     .success(function(data, status, headers, config) {
                                       alert("success");
                                     })
                                     .error(function(data, status, headers, config) {
                                         alert("fail");
                                     });
                                 }
                           }])
  </code></pre>
  
  <p><strong>controller.java</strong> </p>
  
  <pre><code>@RequestMapping(value="/imageUpload",method=RequestMethod.POST)
  @ResponseBody
  public String imageUpload(@RequestBody MultipartFile data){
  
      return "success";
  }
  </code></pre>
  
  <p>when I run with the following request, I got some exception in the web service.</p>
  
  <p><strong>Remote Address</strong>:127.0.0.1:8080
  Request URL:<a href="http://localhost:8080/imageUpload" rel="nofollow">http://localhost:8080/imageUpload</a>
  Request Method:POST
  Status Code:500 Internal Server Error
  Request Headersview source
  Accept:application/json, text/plain, <em>/</em>
  Accept-Encoding:gzip, deflate
  Accept-Language:en-US,en;q=0.8
  Connection:keep-alive
  Content-Length:1850
  Content-Type:application/json;charset=UTF-8
  Host:localhost:8080
  Origin:file://
  User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2214.115 Safari/537.36**</p>
  
  <p><strong>Request payload</strong>
  data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAFIklEQVR4Xu3VsRHAMAzEsHj/pTOBXbB9pFchyLycz0eAwFXgsCF.......</p>
  
  <p><strong>Response header</strong>
  Connection:close
  Content-Type:application/json;charset=UTF-8
  Date:Fri, 24 Apr 2015 12:40:35 GMT
  Server:Apache-Coyote/1.1
  Transfer-Encoding:chunked</p>
  
  <p><strong>Exception in java</strong> 
  org.springframework.web.multipart.MultipartException: The current request is not a multipart request</p>