我正在使用 ng-flow 上传图片。
我需要将我的上传设置为内容类型 application/json: Node (Express) request body empty 但是如何?
我的代码基于此处的示例:
https://github.com/flowjs/flow.js/tree/master/samples/Node.js
我猜它在标题配置中,但我猜。这是我的 $scope.image 对象:
{
image: {
support: true
supportDirectory: true
files:
[ {
flowObj: {
$ref: $
}
file: {
webkitRelativePath:
lastModifiedDate: { }
name: super-phillip (1).gif
type: image/gif
size: 931802
}
name: super-phillip (1).gif
size: 931802
relativePath: super-phillip (1).gif
uniqueIdentifier: 931802-super-phillip1gif
chunks:
[ ]
paused: false
error: true
averageSpeed: 0
currentSpeed: 0
_lastProgressCallback: 1399049249446
_prevUploadedSize: 931802
_prevProgress: 0
} ]
defaults: {
chunkSize: 1048576
forceChunkSize: false
simultaneousUploads: 3
singleFile: false
fileParameterName: file
progressCallbacksInterval: 500
speedSmoothingFactor: 0.1
query: { }
headers: { }
withCredentials: false
preprocess: null
method: multipart
prioritizeFirstAndLastChunk: false
target: /
testChunks: true
generateUniqueIdentifier: null
maxChunkRetries: 0
chunkRetryInterval: null
permanentErrors:
[ 404, 415, 500, 501 ]
onDropStopPropagation: false
}
opts: {
chunkSize: 1048576
forceChunkSize: false
simultaneousUploads: 1
singleFile: true
fileParameterName: file
progressCallbacksInterval: 500
speedSmoothingFactor: 0.1
query: {
$ref: $["defaults"]["query"]
}
headers: {
$ref: $["defaults"]["headers"]
}
withCredentials: false
preprocess: null
method: multipart
prioritizeFirstAndLastChunk: false
target: ./upload
testChunks: true
generateUniqueIdentifier: null
maxChunkRetries: 3
chunkRetryInterval: 5000
permanentErrors:
[ 404, 501 ]
onDropStopPropagation: false
}
events: {
catchall:
[ null, null ]
}
onDrop: null
preventEvent: null
}
}