ZipFile.WriteFile
-----------------

Reads a file and writes it to the zip archive.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Compression](component_Compression.md) | [3.4](newinversion34.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "ZipFile.WriteFile"; Path ) 

**MBS**( **"ZipFile.WriteFile";** /\* Reads a file and writes it to the zip archive. \*/  
**$Path**) /\* The native file path to the file to read and put into the archive. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the file to read and put into the archive. | $path |

### Result

Returns OK on success.

### Description

Reads a file and writes it to the zip archive.  
Please use [ZipFile.CreateFile](ZipFileCreateFile.md) first to create a new file before writing to it.  
This works with all types of files.  
  
See [FileDialog](component_FileDialog.md) functions if you like to show a save dialog to pick a destination for the file path.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) 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](component_FileDialog.md) 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](ZipFileCreateFile.md)"; "test.txt"; $date )  
MBS ( "ZipFile.WriteFile"; "/tmp/test.txt" )  
### See also

- [Files.WriteFile](FilesWriteFile.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [WordFile.WriteFile](WordFileWriteFile.md)
- [ZipFile.CreateFile](ZipFileCreateFile.md)
- [ZipFile.WriteHex](ZipFileWriteHex.md)
- [ZipFile.WriteText](ZipFileWriteText.md)

### Blog Entries

- [MBS Filemaker Plugin, version 4.2pr1](https://www.mbsplugins.de/archive/2014-04-02/MBS_Filemaker_Plugin_version_4/monkeybreadsoftware_blog_filemaker)

### FileMaker Magazin

- [Ausgabe 5/2013, Seite 22](https://filemaker-magazin.de/neuigkeit/3701-Appetithappen-FMM_201305)

This function checks for a license.

Created 18th August 2014 , last changed 22nd December 2022

  
[ZipFile.WriteContainer](ZipFileWriteContainer.md) - [ZipFile.WriteHex](ZipFileWriteHex.md)

[HTML Version](ZipFileWriteFile.shtml)