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

CURL.CloseOutputFile

Closes the data output file.

Component Version macOS Windows Linux Server iOS SDK
CURL 2.6 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "CURL.CloseOutputFile"; curl )   More

Parameters

Parameter Description Example
curl The CURL session handle. $curl

Result

Returns "OK" on success or error message.

Description

Closes the data output file.
To create file for data use CURL.CreateOutputFile function.
The plugin closes files automatically when you call CURL.Release.
Do not call this method while a transfer is running.
In case close operation itself fails, the result is a number with the native file system error code.

Examples

Download URL to temp file:

Set Variable [$curl; Value:MBS("CURL.New")]
#this is URL to download
Set Variable [$url; Value:"https://www.monkeybreadsoftware.com/filemaker/test.txt"]
#get file name from URL
Set Variable [$name; Value:MBS( "Path.LastPathComponent"; $URL )]
#now make temp file path
Set Variable [$path; Value:MBS( "Path.AddPathComponent"; MBS( "Folders.SystemTemporary" ); $name )]
#set URL to download
Set Variable [$r; Value:MBS("CURL.SetOptionURL"; $curl; $url )]
#open destination file
Set Variable [$r; Value:MBS("CURL.CreateOutputFile"; $curl; $path)]
#run transfer
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
#close destination file
Set Variable [$r; Value:MBS("CURL.CloseOutputFile"; $curl)]
#get debug messages
Set Field [CURL Test::debug; MBS("CURL.GetDebugMessages"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $curl)]

Close output file:

MBS("CURL.CloseOutputFile"; $curl)

See also

Release notes

Blog Entries

This function checks for a license.

Created 18th August 2014, last changed 3th January 2023


CURL.CloseInputFile - CURL.CreateDebugOutputFile