【问题标题】:Lib angular file upload with field data object json使用字段数据对象 json 上传 Lib 角度文件
【发布时间】:2015-10-09 15:39:22
【问题描述】:

我正在使用 lib angular-file-upload

如何在下面的请求中添加$http请求的日期字段:

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'},    
    });

在我的请求中需要发送一个包含以下项目的 json 对象(日期字段):

json object - data 

{
    "receiver":"", 
    "localAddress":"", // ip 
    "attachment":"", // name file
    "content":"" // content message
}

谢谢。

【问题讨论】:

    标签: angularjs angular-file-upload


    【解决方案1】:

    假设您使用的是这个库:https://github.com/nervgh/angular-file-upload/,您可以使用 formData 属性传递其他数据

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-05-06
      • 2022-01-05
      • 2014-11-16
      • 1970-01-01
      • 2018-01-28
      • 1970-01-01
      • 2016-03-15
      • 2018-06-04
      相关资源
      最近更新 更多