带有字段数据对象的 Lib angular 文件上传 json
Lib angular file upload with field data object json
我正在使用库 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
}
谢谢。
假设您正在使用此库:https://github.com/nervgh/angular-file-upload/,您可以使用 formData
属性
传递额外的数据
我正在使用库 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
}
谢谢。
假设您正在使用此库:https://github.com/nervgh/angular-file-upload/,您可以使用 formData
属性