【图片上传】

<input type="file" name="picture"> 没有上传文件时输出 req.files.picture

{ fieldName: 'picture',
  originalFilename: '',
  path: 'upload/5157-mukcpk',
  headers: 
   { 'content-disposition': 'form-data; name="picture"; filename=""',
     'content-type': 'application/octet-stream' },
  ws: 
   { _writableState: 
      { highWaterMark: 16384,
        objectMode: false,
        needDrain: false,
        ending: true,
        ended: true,
        finished: true,
        decodeStrings: true,
        defaultEncoding: 'utf8',
        length: 0,
        writing: false,
        sync: true,
        bufferProcessing: false,
        onwrite: [Function],
        writecb: null,
        writelen: 0,
        buffer: [],
        errorEmitted: false },
     writable: true,
     domain: null,
     _events: { error: [Object], close: [Object] },
     _maxListeners: 10,
     path: 'upload/5157-mukcpk',
     fd: null,
     flags: 'w',
     mode: 438,
     start: undefined,
     pos: undefined,
     bytesWritten: 0,
     open: [Function],
     _write: [Function],
     destroy: [Function],
     close: [Function],
     destroySoon: [Function],
     pipe: [Function],
     write: [Function],
     end: [Function],
     setMaxListeners: [Function],
     emit: [Function],
     addListener: [Function],
     on: [Function],
     once: [Function],
     removeListener: [Function],
     removeAllListeners: [Function],
     listeners: [Function] },
  size: 0,
  name: '',
  type: 'application/octet-stream' }
原文地址:https://www.cnblogs.com/jzm17173/p/4524028.html