Skip to content

Instantly share code, notes, and snippets.

@fronteer-kr
Last active August 29, 2015 14:27
Show Gist options
  • Save fronteer-kr/5205728fc4811b5f8e39 to your computer and use it in GitHub Desktop.
Save fronteer-kr/5205728fc4811b5f8e39 to your computer and use it in GitHub Desktop.
total.js 의 다중 파일 업로드시 문제점 조치
// internal.js 라인 208 라인 부근
parser.onPartEnd = function() {
if (stream !== null) {
stream.end();
stream = null;
}
if (req.buffer_exceeded)
return;
if (tmp.$is) {
delete tmp.$data;
delete tmp.$is;
delete tmp.$step;
//------------------------------------------------
// (2015.8.7 By SSK)
// 여러개 파일이 올라오는 경우,
// 최종 파일정보로 엎어치는 문제 처리
//
//req.files.push(tmp); // 이부분이 문제 (tmp 가 반복사용 - reference)
var tmp2 = framework_utils.copy(tmp); // Object 복사
req.files.push(tmp2);
//------------------------------------------------
framework.emit('upload-end', req, tmp);
return;
}
tmp.$data = tmp.$data.toString(ENCODING);
var temporary = req.body[tmp.name];
if (temporary === undefined) {
req.body[tmp.name] = tmp.$data;
return;
}
if (temporary instanceof Array) {
req.body[tmp.name].push(tmp.$data);
return;
}
temporary = [temporary];
temporary.push(tmp.$data);
req.body[tmp.name] = temporary;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment