Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

ZipFile.CreateFile

Creates a new file in the zip archive.

Component Version macOS Windows Linux Server iOS SDK
Compression 3.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes

Deprecated

This function was deprecated. Use Archive.Compress instead.

MBS( "ZipFile.CreateFile"; filename; date { ; Comment; Encoding; zip64 } )   More

Parameters

Parameter Description Example Flags
filename The filename to use. Can include path information with slashes as delimiter. "myfolder/test.txt"
date The file date to use. Get(CurrentTimestamp)
Comment The file comment. "My first file." Optional
Encoding The text encoding for the comment parameter.
Default is UTF-8.
Possible encoding names: ANSI, ISO-8859-1, Latin1, Mac, Native, UTF-8, DOS, Hex, Base64 or Windows. More listed in the FAQ.
UTF8 Optional
zip64 Pass 1 to enable 64-bit zip file.
Default is 0 for 32-bit zip file.
0 Optional

Result

Return OK or error.

Description

Creates a new file in the zip archive.
Use this method before writing data to the file using ZipFile.WriteContainer or ZipFile.WriteText.
Before creating files in archive, you need to open it using ZipFile.Open.
If you want to encrypt file, please use ZipFile.UsePassword before calling this function.

Deprecated due to missing unicode support. Please use Archive.Compress for new projects.

This function requires a native path. Use Path.FileMakerPathToNativePath to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use FileDialog functions.
For Server be aware that server has limited permissions and may not be able to access all files on a computer.

Examples

Creates a file:

MBS( "ZipFile.CreateFile"; "test.txt"; $date )

See also

Release notes

Example Databases

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 7th February 2023


ZipFile.CompressFiles - ZipFile.Open