0
다음은 이미지 파일과 TODO 작업 및 설명에 대한 정보를 보내려는 HTML 페이지입니다. http://pastebin.com/W9TVy4Annode.js에서 다중 부분 데이터를 보내고받는 방법은 무엇입니까?
form.on('part', (part) => {
if (part.filename) {
let imagePath = ''
let privateIndex // will hold the index for private images
let index // will hold the index for the public images
let file = ''
part.setEncoding('binary')
part.on('data', (data) => {
file += data
})
part.on('end',() => {
if (isPrivate) {
// handle a private image
} else {
// handle a public image
}
if (!fs.existsSync(imagePath)) {
fs.mkdir(imagePath) // create the folder for the image
}
imagePath += isPrivate ? privateIndex + '.jpg' : index + '.jpg' // add the image name to complete the path for saving
fs.writeFile(imagePath, file, 'ascii', (err) => {
// stuff
}
})
callback(part.filename)
})
나는 위와 같이 Node.js를에서 다자간를 사용하여 파일을받을 수 있지만 나는 내 인생에 대한 TODO 작업의 설명과 이름에 대한 정보를 수신 할 수있는 방법을 알고있다.
누구나 내가 할 수있는 바보 같은 실수를 지적 할 수 있습니까?