danialfarid / ng-file-upload

Lightweight Angular directive to upload files with optional FileAPI shim for cross browser support
MIT License
7.87k stars 1.6k forks source link

data sent as application/json #1950

Open DanRamGim opened 7 years ago

DanRamGim commented 7 years ago

how can I achieve to send my file in ng-file-upload as a application/json to be able to receive the file in my REST server ?

Thank you in advance

JSONRice commented 7 years ago

Set the content-type in the header section. Read the documentation and search for 'type'

gianpaj commented 4 years ago

For anybody still using this ( \sadpanda** for legacy apps):

Upload.http({
  url: '/api/uploadImage',
  data: json,
  headers : {
    'Content-Type': 'application/json'
  },
});