는 ExpressJS 파일 업로드를 수신하는 응용 프로그램을 고려하십시오. 또한 사용하고 가능한 일부 이벤트하지만 여전히 아무런 영향을 갖고있는 것 같아요 각 파일에 대해 나에게 다음과 같은 객체를 제공 bodyParser() 미들웨어 :노드 XHR 파일 업로드 이벤트
{
file: {
domain: null,
_events: {},
_maxListeners: 10,
size: 43330194,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
name: 'google-chrome-stable_current_amd64.deb',
type: 'application/x-deb',
hash: null,
lastModifiedDate: Sat Aug 24 2013 20: 59: 00 GMT + 0200(CEST),
_writeStream: {
_writableState: [Object],
writable: true,
domain: null,
_events: {},
_maxListeners: 10,
path: 'public/uploads/a4abdeae32d56a2494db48e9b0b22a5e.deb',
fd: null,
flags: 'w',
mode: 438,
start: undefined,
pos: undefined,
bytesWritten: 43330194,
closed: true,
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]
},
open: [Function],
toJSON: [Function],
write: [Function],
end: [Function],
setMaxListeners: [Function],
emit: [Function],
addListener: [Function],
on: [Function],
once: [Function],
removeListener: [Function],
removeAllListeners: [Function],
listeners: [Function]
}
}
내가 progress 및 complete 이벤트를 활용하는 방법을 이해하는 데 도움 싶습니다
작업.
이 코드를 작성하겠다는 문서가 있습니까? 나는 그것을 다르게 보았다. (http://howtonode.org/really-simple-file-uploads). – FakeRainBrigand
일반 html 형식 대신 xmlhttprequest를 사용하여 파일을 업로드하고 있습니다. 그러나 req 객체에서 데이터 이벤트를 사용할 수 있으므로 요청이 들어 오면 (?) – Dawid
본문이 이미 파서 미들웨어에서 파싱됩니다. 그것을 제거하면 데이터를 가져옵니다. –