title: SyntaxError: Unexpected token S, AngularJS, Spring
body: <p>I'm making a simple establishment of registration that must have data and a logo. In tests could transmit the file and the data separately but when trying to send them together the following error occurs:</p>
  
  <pre><code>SyntaxError: Unexpected token S
  at Object.parse (native)
  at qc (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:14:245)
  at Zb (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:76:423)
  at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:77:283
  at r (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:7:302)
  at Zc (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:77:265)
  at c (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:78:414)
  at https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:112:113
  at n.$get.n.$eval (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:126:15)
  at n.$get.n.$digest (https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js:123:106)
  </code></pre>
  
  <p>The Angular Controller</p>
  
  <pre><code>angular.module('EntregaJaApp').controller('EstabelecimentoController', ['$scope', '$http','Upload', function($scope, $http,Upload){
  
  $scope.salvar = function(){
           Upload.upload({
              url: 'http://localhost:8080/site-web/gerencial/estabelecimento/salvar',
              file: $scope.picFile[0],
              method: 'POST',
              headers: {'Content-Type': 'multipart/form-data'}, // only for html5
              data: {'estabelecimento': $scope.estabelecimento}
          });
  }}
  </code></pre>
  
  <p>The Spring Controller</p>
  
  <pre><code>@Controller
  @RequestMapping("/gerencial/estabelecimento")
  public class EstabelecimentoController {
  
  @Autowired
  private EstabelecimentoService estabelecimentoService;
  
      @RequestMapping(value = "/salvar",  method = RequestMethod.POST)
  public ResponseEntity&lt;?&gt;  salvar(Estabelecimento estabelecimento,@RequestParam(value="file", required=false) MultipartFile file){
      try {
            byte[] bytes;
  
              if (!file.isEmpty()) {
                   bytes = file.getBytes();
                  //store file in storage
              }
  
              System.out.println(String.format("receive %s from %s", file.getOriginalFilename(), estabelecimento.getNome()));
          estabelecimentoService.salvar(estabelecimento);
          return new ResponseEntity&lt;&gt;(MensagensGerais.SUCESSO_SALVAR,HttpStatus.OK);
      } catch (Exception e) {
          return new ResponseEntity&lt;&gt;((StringUtil.eVazia(e.getMessage()) ? MensagensGerais.ERRO_CONSULTAR : e.getMessage()),HttpStatus.BAD_REQUEST);
      }
  }
     }
  </code></pre>