Lib angular file upload with field data object json


I’m using lib angular-file-upload.

How do I add the date field of $http request on request below:

var app = angular.module('app', ['angularFileUpload']);

app.controller('Aula21Controller', function($scope, FileUploader){

    var uploader = $scope.uploader = new FileUploader({
        url : 'http://localhost:8080/work/v1/chats',
        alias: 'message-body',
        headers: {'X-Client-Instance': '1.221@0000010000083359', 'Content-Type': 'multipart/formdata'},    

In my request needs to send a json object (date field) with the items below:

json object - data 

    "localAddress":"", // ip 
    "attachment":"", // name file
    "content":"" // content message



Assuming you’re using this lib:, you can pass additional data using the formData property

Answered By – Ids Klijnsma

Answer Checked By – Timothy Miller (AngularFixing Admin)

Leave a Reply

Your email address will not be published.