출처 - http://www.jejusarang.com/?1221669731&PHPSESSID=a5ebd25c3858b9511d8c1ea8c3f68077
*up_process.php 파일
1 2 3 4 5 6 | $UpFile = $HTTP_POST_FILES [ "ImageFile" ][name];
if ( $UpFile )
{
$FileName = GetUniqFileName( $UpFile , $SavePath );
move_uploaded_file( $HTTP_POST_FILES [ "ImageFile" ][tmp_name], "$SavePath$FileName" );
}
|
*GetUniqFileName 함수
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | function GetUniqFileName( $FN , $PN )
{
$FileExt = substr ( strrchr ( $FN , "." ), 1);
$FileName = substr ( $FN , 0, strlen ( $FN ) - strlen ( $FileExt ) - 1);
$ret = "$FileName.$FileExt" ;
while ( file_exists ( $PN . $ret ))
{
$FileCnt ++;
$ret = $FileName . "_" . $FileCnt . "." . $FileExt ;
}
return ( $ret );
|
|
|
댓글