Click or drag to resize

AddFileEx 메서드

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

형식
syntax
retCode = objZipFile.AddFileEx(srcName, fileNameInZip)

objZipFile

Required. ZipFile 오브젝트

retCode

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

srcName

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

fileNameInZip

String. ZIP 파일 내부에서 표시되는 이름을 지정합니다.

설명

srcName에서 지정된 원본 데이터를 읽어 ZIP 파일에 fileNameInZip에 명시된 이름으로 추가합니다. AddFolder 메서드로 추가한 폴더 명이 fileNameInZip에 포함되어 있다면 지정된 서브 폴더에 추가됩니다. 아래 예제는 루트 폴더에 "파일1.htm" 파일을 추가하고 "서브 폴더"에 "파일2.htm" 파일을 추가하는 것을 보여줍니다.

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