Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 空请求主体,文件从AngularJS通过ng流上载到Node/Express_Node.js_Angularjs_Express_Flow Js - Fatal编程技术网

Node.js 空请求主体,文件从AngularJS通过ng流上载到Node/Express

Node.js 空请求主体,文件从AngularJS通过ng流上载到Node/Express,node.js,angularjs,express,flow-js,Node.js,Angularjs,Express,Flow Js,我正在使用ng flow上传图片 我需要将上传设置为内容类型application/json: 但是怎么做呢 我的代码基于以下示例: 我猜它在标题配置中,但我猜。 这是我的$scope.image对象: { image: { support: true supportDirectory: true files: [ { flowObj: { $ref: $ } file: { web

我正在使用ng flow上传图片

我需要将上传设置为内容类型application/json: 但是怎么做呢

我的代码基于以下示例:

我猜它在标题配置中,但我猜。 这是我的$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
     } 
     } 

最新的express bodyParser()不再允许多部分formdata,因此您必须使用中间件,如connect multiparty或multer