我有一个输入字段,如:
input(type='file', id='avatar', name='avatar', class='fivecol', accept='image/*')
并在我的控制器中检查req.files.avatar
...即使它是空的,输出仍然会被记录,并暂时存储(某些)/uploads
。
以下是req.files.avatar
{ avatar:
{ domain: null,
_events: null,
_maxListeners: 10,
size: 0,
path: 'uploads/aa7571f48cc1d0a3d1242d737f8c5fa0',
name: '',
type: 'application/octet-stream',
hash: false,
lastModifiedDate: null,
_writeStream:
{ domain: null,
_events: null,
_maxListeners: 10,
path: 'uploads/aa7571f48cc1d0a3d1242d737f8c5fa0',
fd: 21,
writable: false,
flags: 'w',
encoding: 'binary',
mode: 438,
bytesWritten: 0,
busy: false,
_queue: [],
_open: [Function] },
length: [Getter],
filename: [Getter],
mime: [Getter] } }
为什么这样做?此外,在名为0 bytes
的{{1}}文件夹中存在/uploads
文件(或每次生成的任何其他随机哈希)。
此外,为什么不明确从aa7571f48cc1d0a3d1242d737f8c5fa0
中清除那些临时上传的文件?