Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server   Client   Old   Guides   Examples
New in version: 8.3   8.4   8.5   9.0   9.1   9.2   9.3   9.4   9.5   10.0    Statistic  


Sets input to file data from the container value.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
CURL 2.5 Yes Yes Yes Yes Yes
MBS( "CURL.SetInputFile"; curl; data )   More


Parameter Description Example value
curl The CURL session handle. $curl
data The container value with the data to upload.


Returns "OK" on success.


Sets input to file data from the container value.
Also sets input file length. You need to define input data for file uploads, http posts and http put operations.

To use a file from disk, please use CURL.OpenInputFile.
You may need to use CURL.SetOptionUpload to make it an upload for FTP/SFTP.

Using this function is not recommended for more than a 1 GB of data. If you need more, better stream the data with CURL.OpenInputFile from a file.


Upload data from container to FTP Server:

Set Variable [$curl; Value:MBS("CURL.New")]
Set Variable [$result; Value:MBS("CURL.SetOptionURL"; $curl; "ftp://test.test/test/hello.dat")]
Set Variable [$result; Value:MBS("CURL.SetOptionUpload"; $curl; 1)]
Set Variable [$result; Value:MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password)]
Set Variable [$result; Value:MBS("CURL.SetOptionUsername"; $curl; CURL Test::Name)]
Set Variable [$result; Value:MBS("CURL.SetInputFile"; $curl; CURL Test::MyContainer)]
Set Field [CURL Test::Result; MBS("CURL.Perform"; $curl)]
Set Field [CURL Test::debug; MBS("CURL.GetDebugAsText"; $curl)]
Set Variable [$result; Value:MBS("CURL.Cleanup"; $curl)]

Upload file from container:

Set Variable [$curl; Value:MBS("CURL.New")]

# FTP URL with destination file name:
Set Variable [$result; Value: MBS("CURL.SetOptionURL" ; $curl ; "")]
Set Variable [$result; Value: MBS("CURL.SetOptionUpload" ; $curl ; 1)]
Set Variable [$result; Value: MBS("CURL.SetOptionPassword" ; $curl ; "xxx" )]
Set Variable [$result; Value: MBS("CURL.SetOptionUsername" ; $curl ; "yyy" )]

# Pick file from desktop:
// Set Variable [$Desktop; Value: MBS("Folders.UserDesktop")]
// Set Variable [$Path; Value: MBS("Path.AddPathComponent"; $desktop; "AZ1677ZZ.jpg")]
// Set Variable [$result; Value: MBS( "CURL.OpenInputFile" ; $curl ;$path )]

# Pick file from container:
Set Variable [$result; Value: MBS( "CURL.SetInputFile" ; $curl ; Test::ImageFileContainer )]

# Upload file
Set Field [Test::PerformResult; MBS( "CURL.Perform" ; $curl )]
Set Field [Test::DebugMessages; MBS( "CURL.GetDebugAsText" ; $curl)]
Set Variable [$result; Value:MBS( "CURL.Cleanup" ; $curl )]

Do a POST request wiht input field:

Set Variable [ $curl ; Value: MBS("CURL.New") ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionURL"; $curl; CURL Test::URL & CURL Test::filename) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUpload"; $curl; 1) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionCustomRequest"; $curl; "POST") ]
Set Variable [ $result ; Value: MBS("CURL.SetInputFile"; $curl; CURL Test::Image) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionPassword"; $curl; CURL Test::Password) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionUsername"; $curl; CURL Test::Name) ]
Set Variable [ $result ; Value: MBS("CURL.SetOptionVerbose"; $curl; 1) ]
Set Field [ CURL Test::Result ; MBS("CURL.Perform"; $curl) ]
Set Field [ CURL Test::debug ; MBS("CURL.GetDebugAsText"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Cleanup"; $curl) ]

See also

Example Databases

Blog Entries

Release notes

  • Version 9.5

Created 18th August 2014, last changed 9th July 2019

CURL.SetFinishedScript   -   CURL.SetInputGIF

Feedback: Report problem or ask question.

MBS Xojo Plugins