파일 업로드시 동일한 파일(이미지등)일 경우 파일 이름에 번호를 부여하여 덮어써지지 않도록 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6583 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2009-06-18 05:02:16 +00:00
parent c2bc3067a2
commit 69c9c5cb6c
2 changed files with 8 additions and 4 deletions

View file

@ -243,7 +243,6 @@
}
}
debugPrint($obj->content);
// 문서 번호 설정
$document_srl = getNextSequence();
@ -265,7 +264,7 @@
}
}
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$obj->content = str_replace($uploaded_target_path,sprintf('./files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$oDocumentController = &getController('document');
$obj->allow_comment = 'Y';
@ -356,7 +355,7 @@
$obj->uploaded_count += $file_count;
}
}
$obj->content = str_replace($uploaded_target_path,sprintf('/files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$obj->content = str_replace($uploaded_target_path,sprintf('./files/attach/images/%s/%s%s', $this->module_srl, getNumberingPath($document_srl,3), $filename), $obj->content);
$oDocumentController = &getController('document');
$output = $oDocumentController->updateDocument($oDocument,$obj);

View file

@ -394,8 +394,13 @@
// direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함
$file_info['name'] = preg_replace('/\.(php|phtm|htm|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']);
$path = sprintf("./files/attach/images/%s/%s%s/", $module_srl,getNumberingPath($upload_target_srl,3),md5(crypt(rand(1000000,900000), rand(0,100))));
$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3));
$filename = $path.$file_info['name'];
$idx = 1;
while(file_exists($filename)) {
$filename = $path.preg_replace('/\.([a-z0-9]+)$/i','_'.$idx.'.$1',$file_info['name']);
$idx++;
}
$direct_download = 'Y';
} else {
$path = sprintf("./files/attach/binaries/%s/%s", $module_srl, getNumberingPath($upload_target_srl,3));