Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
CURL.SetInputFile
Sets input to file data from the container value.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
CURL | 2.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
curl | The CURL session handle. | $curl | |
data | The container value with the data to upload. | ||
Offset | The offset where to start within container. | 0 | Optional |
Length | Size of data to take from the container. Length of container data must be ≥ Length + Offset. |
1024*1024*10 | Optional |
Result
Returns "OK" on success.
Description
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.
Examples
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.GetDebugMessages"; $curl)]
Set Variable [$result; Value:MBS("CURL.Release"; $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 ; "ftp://12.34.56.78/AZ1677ZZ.jpg")]
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.GetDebugMessages" ; $curl)]
Set Variable [$result; Value:MBS( "CURL.Release" ; $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.GetDebugMessages"; $curl) ]
Set Variable [ $result ; Value: MBS("CURL.Release"; $curl) ]
Upload from container field by name:
Set Variable [$r; Value: MBS( "CURL.SetInputFile"; $curl; GetField($fieldName) )
See also
- CURL.CloseInputFile
- CURL.OpenInputFile
- CURL.SetInputGIF
- CURL.SetInputPDF
- CURL.SetInputPNG
- CURL.SetInputText
- CURL.SetOptionUserName
- CURL.SetupAWS
- Folders.UserDesktop
- Path.AddPathComponent
Release notes
- Version 12.0
- Added Offset and Length parameters to CURL.SetInputFile, CURL.SetInputGIF, CURL.SetInputJPEG, CURL.SetInputPDF and CURL.SetInputPNG to only upload a portion of the container.
- Version 10.5
- Fixed memory leaks in CURL.SetInputJPEG, CURL.SetInputPNG, CURL.SetInputPDF, CURL.SetInputGIF and CURL.SetInputFile not freeing container. Broken with 10.0.
- Version 9.5
- Fixed bug in CURL.SetInputFile with error message "Uploaded unaligned file size".
Example Databases
- CURL/Amazon S3/Amazon S3 Upload File
- CURL/Amazon S3/Amazon S3 Upload Picture
- CURL/Amazon S3/Containers in S3
- CURL/CURL Custom Function
- CURL/FTP/CURL FTP Upload multiple files
- CURL/FTP/CURL FTP Upload
- CURL/SFTP/CURL sFTP Upload File
Blog Entries
- SFTP Upload with temporary file
- CURL Custom Function
- MBS FileMaker Plugin, version 11.6pr2
- Translating Insert from URL options for CURL to MBS Plugin calls
- MBS FileMaker Plugin, version 10.5pr7
- MBS FileMaker Plugin, version 9.5pr6
- Amazon S3 Upload with Mime Type and Permissions
- Tip of the day: FTP File Upload
This function checks for a license.
Created 18th August 2014, last changed 3th January 2023