태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.
페이지를 읽고 있습니다. ( 아쿠아바다's Blog )
분류 전체보기 (769)
쉐어포인트 (24)
Exchange (12)
SQL (121)
XML (36)
WEB (294)
O / S (97)
삶의향기 (162)
기획 (19)
RSS 피드(IE 7.0부터 기본 지원됩니다. 이전 버전 사용자는 접합한 툴을 사용하세요!!)

<%

'==================================================================================

'== 설명 : 폴더 존재 여부를 체크하여 폴더 만들기

'== 이름 : ChkDirecoty(dir, gubun, dir_status)

'== 변수 : dir(경로명), gubun(폴더구분자),dir_status(가상경로:v, 물리적경로:p)

'== 반환 : String

'===================================================================



Sub ChkDirectory(dir,gubun, dir_status)

Dim objFile, objStream

Dim i,tmp



Set objFile  = Server.CreateObject("Scripting.FileSystemObject")

for i = 0 to ubound(split(dir,gubun))-1

tmp = tmp&split(dir,gubun)(i)&gubun



If dir_status = "v" then

IF not(objFile.folderexists(Server.MapPath(tmp))) then

objFile.createfolder(Server.MapPath(tmp))

End If

Elseif dir_status = "p" then

IF not(objFile.folderexists(tmp)) then

objFile.createfolder(tmp)

End If

End If

next

Set objFile = Nothing

End Sub



'===================================================================

'== 설명 : 화일 지우기

'== 이름 : DeleteTxtFile(FileName, path_status)

'== 변수 : FileName : 전체 화일명, status : 파일경로 형태(v:가상경로,r:물리적경로)

'== 반환 : String

'===================================================================

Sub DeleteTxtFile(FileName, path_status)

Dim objFile, objStream, Err



' On Error Resume Next

Set objFile  = Server.CreateObject("Scripting.FileSystemObject")

If path_status = "v" then

objFile.DeleteFile Server.MapPath(FileName)

Else

objFile.DeleteFile FileName

End If



Set objFile = Nothing

' Err.Clear

End Sub





'===================================================================

'== 설명 : 고유한 파일이름으로 변환

'== 이름 : GetUniqueName

'== 변수 : String

'== 반환 : String

'===================================================================



Function GetUniqueName(byRef strFileName, DirectoryPath)

    Dim strName, strExt

    strName = Mid(strFileName, 1, InstrRev(strFileName, ".") - 1) ' 확장자를 제외한 파일명을 얻는다.

    strExt = Mid(strFileName, InstrRev(strFileName, ".") + 1) '확장자를 얻는다



    Dim fso

    Set fso = Server.CreateObject("Scripting.FileSystemObject")



    Dim bExist : bExist = True

    '우선 같은이름의 파일이 존재한다고 가정

    Dim strFileWholePath : strFileWholePath = DirectoryPath & "\" & strName & "." & strExt

    '저장할 파일의 완전한 이름(완전한 물리적인 경로) 구성

    Dim countFileName : countFileName = 0

    '파일이 존재할 경우, 이름 뒤에 붙일 숫자를 세팅함.



    Do While bExist ' 우선 있다고 생각함.

        If (fso.FileExists(strFileWholePath)) Then ' 같은 이름의 파일이 있을 때

            countFileName = countFileName + 1 '파일명에 숫자를 붙인 새로운 파일 이름 생성

            strFileName = strName & "-" & countFileName & "." & strExt

            strFileWholePath = DirectoryPath & "\" & strFileName

        Else

            bExist = False

        End If

    Loop

    GetUniqueName = strFileWholePath

End Function





'===================================================================

'== 설명 : 클라이언트에서 업로드된 파일명 리턴

'== 이름 : ChkFileName

'== 변수 : String

'== 반환 : String

'===================================================================



Function ChkFileName(name)

Dim tmpName, tmpExt, arrTmpName, tmpFileName



tmpName = Mid(name, 1, InstrRev(name, ".") - 1)

tmpExt = Mid(name, InstrRev(name, ".") + 1)



arrTmpName = split(tmpName,"\")

tmpName = arrTmpName(Ubound(arrTmpName))

tmpFileName = tmpName&"."&tmpExt



ChkFileName = tmpFileName

End Function









'==================================================================================

'== 설명 : 화일 존재 여부를 체크하여 리턴

'== 이름 : ChkDirecoty(dir_status, filePath)

'== 변수 : dir_status(가상경로:v, 물리적경로:p), filePath(디렉토리포함)

'== 반환 : 존재(true), 없음(false)

'===================================================================



Function ChkFileExist(dir_status, filePath)

Dim objFile, tmpFile



Set objFile  = Server.CreateObject("Scripting.FileSystemObject")



IF dir_status="v" then

tmpFile = Server.MapPath(filePath)

Else

tmpFile = filePath

End IF



If objFile.FileExists(tmpFile) then

chkFileExist=true

else

chkFileExist=false

End If



Set objFile = Nothing



End Function



%>

http://www.taeyo.pe.kr/threadboard/Content.asp?table=Board_Knowhow&seqs=736&page=1&IsSearch=

좀더 흥미로운 내용이 많이 있습니다.. HOME > WEB/ASP / DotNet를 확인하세요
TAG ,   
0 Trackback, 0 Comment, :
1  ... 274 275 276 277 278 279 280 281 282  ... 769 
Statistics Graph
Total : 557,403 Today : 33