Click or drag to resize

AddFile 메서드

서버에 저장되어 있는 파일을 ZIP 파일에 추가합니다.

형식
syntax
retCode = objZipFile.AddFile(srcName)

objZipFile

Required. ZipFile 오브젝트

retCode

Long. 작업에 대한 결과 코드를 반환합니다. 성공일 경우 0을 반환하며 실패일 경우 오류 코드를 반환합니다.

srcName

String. ZIP 파일에 추가할 파일(완전한 경로 포함)을 지정합니다.

설명

ZIP 파일에는 srcName에서 지정된 경로명에서 파일 이름 부분을 추출해서 추가됩니다. 아래 예제에서 "D:\Source\file1.htm"를 추가할 경우 ZIP 파일 루트 폴더에 file1.htm 파일이 추가됩니다.

추가할 파일과 ZIP 파일에 저장되는 파일 이름이 다를 경우 AddFileEx 메서드를 사용합니다.

예제
ASP
Set zip = Server.CreateObject("TABSUpload4.ZipFile")
If zip.Create("D:\zipped\sources.zip", "") Then
    zip.AddFile "D:\Source\file1.htm"
    zip.AddFile "D:\Source\file2.htm"    
    zip.Close
    Response.Write "ZIP 파일을 성공적으로 생성하였습니다."
Else
    Response.Write "ZIP 파일을 생성할 수 없습니다."
End If