You can select what type of FTP protocol you want to use by using one of the FTPeek_Connect methods. For regular unencrypted FTP, use FTPeek_ConnectFTP. You can also do SFTP with FTPeek_ConnectSFTP or FTPS with FTPeek_ConnectFTPS.
Once you're connected, the plugin functions to upload, download, etc. are the same for all three protocols.
More information about the FTP protocol, as well as the secure variations (SFTP and FTPS) can be found at this Wikipedia article.
This shows an example of connecting to a secure SFTP server, getting a list of files, and downloading one of them.
Step #1: Get public key of the server. This returns text that can be stored in FileMaker.
Set Field[ example::publicKey; FTPeek_GetPublicKey( "host.address.com" ) ] If[ example::publicKey = "ERROR" ] ...show error using FTPeek_LastError...
Step #2: Connect to the server. Requires public key and client authentication.
if[ FTPeek_ConnectSFTP( "host.address.com" ; example::publicKey ; "username" ;
"password" ) = "ERROR" ] ...Handle error...
Step #3: Get a list of files in a directory on the server
Set Field[ example::filesList; FTPeek_GetFileList( "/Users/username/" ) ] if[ example::filesList = "ERROR" ] ...show error using FTPeek_LastError...
Step #4: Download the first file in the list to a temp directory and name it newFileName.
If[ FTPeek_DownloadFile( "/tmp/" ; GetValue( example::filesList; 1 );
"newFileName" ) = "ERROR" ] ...Handle error...
Step #5: Disconnect
If[ FTPeek_Disconnect = "ERROR" ]
...Display error message to user, but we don't need to do anything else...
All functions support referencing remote files and directories as relative or absolute paths.
A relative path references
files and directories starting from the current working directory. For example, if we are in the /uploaded/FTPeek/
directory on the remote
server, changing into backup
would navigate into the /uploaded/FTPeek/backup/
directory.
On the other hand, an absolute path
references files and directories starting from the root directory of the server. If we're in the same /uploaded/FTPeek/
directory and try to
change into /temp
, we would actually end up in /temp/
instead of /uploaded/FTPeek/temp/
, since we start at the root directory instead
of the current working directory.
As seen in the examples, an absolute path starts with a slash /
, while a relative one does not. Either
can be passed in to FTPeek_ChangeDir, FTPeek_Rename, FTPeek_UploadFile, and other functions to reference relative or absolute paths.
When something unexpected happens, a plugin function returns a result of "ERROR"
. This makes it easy to check for errors.
If a plugin function returns "ERROR", call the FTPeek_LastError
function to get a detailed description of what went wrong.
Here is an example of basic error reporting:
Set Variable [ $result = MyPluginFunction("x" ; "y" ; "z") ] If [ $result = "ERROR" ] Show Custom Dialog [ "An error occurred: " & FTPeek_LastError ] End If
Since the string "ERROR"
evaluates to false when evaluated by FileMaker, and most plugin functions return a 1
when successful, you can chain multiple dependent plugin operations together using the "and"
operator.
However, in this case the result will be a 1
or a 0
, not "ERROR"
. For example:
// chain multiple calls together
// if any of the functions fail, the calculation will
// short-circuit with a result of false
,
// and none of the subsequent function calls will be evaluated.
Set Variable [ $success =
FirstPluginFunction("x") and
SecondPluginFunction("y") and
ThirdPluginFunction("z")
]
If [not $success]
Show Custom Dialog [ "An error occurred: " & FTPeek_LastError ]
End If
Note: the above only works for plugin functions which return 1
on success! Check the documentation for each function used in this manner.
If a plugin is not installed correctly, calls to a plugin function will return "?". As part of your startup script, you should check for this occurrence and display a warning accordingly that the plugin needs to be installed. Note: when treated as a boolean true/false value, FileMaker will treat ?
as true
.
FileMaker version 7 or higher.
Java Virtual Machine (JVM) version 1.5 or later. If you are running a JVM earlier than 1.5, you should upgrade.
Download a JVM from http://www.java.com/en/download/. If you are not sure what
version of Java you have installed, you can do java -version
on the command line in Windows or OS X.
Windows, or Mac OS X version 10.4 or higher.
Note to intel Mac users: running this plugin under Rosetta is not supported. Upgrade to FileMaker 8.5 to run our plugin in native Intel mode.
Drag the plugin from the MAC or WIN folder into your FileMaker extensions, and restart FileMaker.
This will also enable the plugin for use with Instant Web Publishing from the FileMaker Pro client software.
If the plugin does not load correctly, double-check that you meet the system requirements.
You do not need to do this step unless you plan on using the plugin with Instant Web Publishing or Custom Web Publishing with FileMaker Server Advanced. You will need an Enterprise License to use this feature.
For installing into the Web Publishing Engine with FileMaker Server or FileMaker Server Advanced, drag the plugin from the MAC or WIN folder
into the FileMaker Server/Web Publishing/publishing-engine/wpc/Plugins
folder. If there is no Plugins
folder inside the wpc
folder, then create it manually.
Restart FileMaker Web Publishing, and now the plugins should be ready to go.
Note that due to a bug which we and other plugin vendors have reported to FileMaker, web plugins do not work in FileMaker Web Publishing Engine 8.0v4 on Mac OS X. You will need to use a later version, like 9, or an earlier version, like 8.0v3. The Windows FileMaker Server 8.0v4 does not have this bug, and will work correctly.
The easiest way to test whether the plugin is working is to have a calculation which calls the version function of the plugin, and display that on an IWP layout. If it shows "?", then the plugin is not working. If it shows a number, then the plugin has been installed successfully.
You do not need to do this step unless you plan on using the plugin with scheduled script triggering, a new feature in FileMaker Server 9. You will need an Enterprise License to use this feature.
/Library/FileMaker Server/Database Server/Extensions
folder.
On Windows, this is at C:\Program Files\FileMaker\FileMaker Server\Database Server\Extensions
.Configuration -> Database Server->Server Plug-ins
and check the box that says 'Enable FileMaker Server to use plug-ins', and then check the 'enabled' box for this plugin.
Click the 'save' button and wait a few seconds to make sure that the 'enabled' check box stays checked. If it does not, then there was an error loading the plugin and you should contact us for help troubleshooting.
You should now be able to write schedules that trigger scripts which use the plugin.360Works has created an AutoUpdate helper database which makes setting up Auto Update much easier. This file includes pre-configured plugin files which you can place on your server, and an auto-update script for each of our plugins which you can paste into your own solution.
You can get the AutoUpdate360Works file at fmp7://autoupdate.360works.com/AutoUpdate360Works. Follow the instructions included in the file to either host your own Auto Update server or pull the files from ours.
Plugins will run in demo mode until they are registered. While running in Demo mode, the product will run for 2 hours every time you launch FileMaker / FileMaker Server / FileMaker Web Publishing Engine. The 2 hour time limit will reset every time you relaunch FileMaker. There is no expiration date when Demo mode stops working. There are no feature differences between the Demo version and the licensed version.
Once you have purchased the plugin, you can register it with the license key. Once a valid license key is entered, the product will run for as long as FileMaker is running. After FileMaker starts up with the plugin installed, open FileMaker preferences, click on the Plug-ins tab, select the plugin from the list, and click the Configure button. Enter your license key and company name in this dialog. You will only need to do this once on a given machine. Alternately, you can use the registration function to register the plugin during a startup script.
Note that if you are running the plugin with FileMaker Server / FileMaker Web Publishing Engine, you must use the registration function to register the plugin, since there is no preferences dialog on FileMaker Server to enter the license key and company name.
We love to hear your suggestions for improving our products! If you are experiencing problems with this plugin, or have a feature request, or are happy with it, we'd appreciate hearing about it. Send us a message on our website, or email us!
FTPeek_SetTransferType( type )
.FTPeek_SetTransferType( type )
.remoteDir
- the directory to navigate intofileType
without specifying initialPath
you'll need
pass in an empty string ""
for the initialPath
parameter.
initialPath
- optional path to set the initial dialog selection to. If empty, will default to the user's home directory.fileType
- option parameter to specify whether to allow "files"
, "directories"
, or both "files + directories"
.title
- optional title string to display as the title of the FileChooser dialog.
"ActiveMode=true"
.
"encoding=UTF8>/code>.
Set Variable[$result =
FTPeek_ConnectFTPS(
"ftp.mysite.com" ;
"username" ;
"password" ;
"ActiveMode=true"
"encoding=UTF8"
)
]
Parameters: host
- address of the server; can be numeric IP address like "127.0.0.1"
or a named one like "ftp.mysite.com"
; if need to connect to a non-standard port number, concatenate the port number to the host name like "ftp.mysite.com:21"
.
username
- the client username.
password
- the client authentication password.
args
- Additional optional arguments ActiveMode
, encoding
.
Returns: 1 on success, ERROR on failure
Here is an example of connecting to FTPS server:
Set Variable[$result = FTPeek_ConnectFTPS( "ftp.mysite.com" ; "username" ; "password" ) ]
"ValidateServerCertificate=false"
.
Set Variable[$result = FTPeek_ConnectFTPS( "ftp.mysite.com" ; "username" ; "password" ; "ValidateServerCertificate=false" ) ]
"ImplicitFTPS=true"
.
Set Variable[$result = FTPeek_ConnectFTPS( "ftp.mysite.com" ; "username" ; "password" ; "ImplicitFTPS=true" ) ]
"ActiveMode=true"
.
"encoding=UTF8>/code>.
Set Variable[$result =
FTPeek_ConnectFTPS(
"ftp.mysite.com" ;
"username" ;
"password" ;
"ActiveMode=true"
"encoding=UTF8"
)
]
Parameters: host
- address of the server; can be numeric IP address like "127.0.0.1"
or a named one like "ftp.mysite.com"
; if need to connect to a non-standard port number, concatenate the port number to the host name like "ftp.mysite.com:990"
username
- the client username
password
- the client authentication password
args
- Additional optional arguments (ValidateServerCertificate, ImplicitFTPS, ActiveMode, encoding
).
See also: FTPeek_Disconnect
Returns: 1 on successful connection, or "ERROR" if an error occurred (use FTPeek_LastError in this case)
host
- address of the server; can be numeric IP address like "127.0.0.1"
or a named one like "ftp.mysite.com"
; if need to connect to a non-standard port number, concatenate the port number to the host name like "ftp.mysite.com:21"
publicKey
- the unique key of the server, obtained by calling FTPeek_GetPublicKey. If a wrong key is entered, the connection will be refused and this error thrown: "The host signature is invalid or the host key was not accepted!"username
- the client usernamepassword
- the client authentication passwordHere is an example:
Set Variable [ $deleteDir ; FTPeek_DeleteDir( "Empty/Directory" ) //relative path example ] Set Variable [ $deleteDir ; FTPeek_DeleteDir( "/home/files/Non empty directory" ; "recursive=true" ) //absolute path example]
remoteDir
- remote directory to deleterecursiveFlag
- optional parameter, specify recursive=true
to enable recursive deleteHere is an example:
Set Variable [ $deleteFile ; FTPeek_DeleteFile( "remoteFiles.txt" ) ] Set Variable [ $deleteFiles ; FTPeek_DeleteFile( "remoteFiles.*" ; "wildcards=true" ) ]
remoteFile
- remote file path to deleteuseWildcards
- optional parameter, specify wildcards=true
to enable wildcard characters *
and ?
in the remote file name to delete matching files.Set Variable [ $deleteLocal ; FTPeek_DeleteLocal( "/Users/username/Desktop/upload.gif" ) ] Set Variable [ $deleteLocal ; FTPeek_DeleteLocal( "c:\\Documents and Settings\\username\\Desktop\\upload.txt" ) ]Parameters:
localFile
- file on the local file system.Returns: 1 on success, ERROR on failure.
remoteSourcePath
- the file path on the remote FTP server to downloadlocalDestPath
- the directory on the computer running FileMaker Pro where the downloaded file should be stored, for example "/Users/Shared/Downloads/"
or "filemac:/Macintosh HD/Users/Shared/Downloads/"
newLocalFileName
- an optional parameter that can be used to locally rename the downloaded file. If left empty, the file will be named whatever it was named on the FTP server.FTPeek_SetTransferType( type )
. For example, this will download a Word document from the FTP server and
store it into a container field:
Set Field[ example::ContainerField;
FTPeek_DownloadFileToContainer("My report.doc") ]
remoteSourcePath
- the file path on the remote server to downloadSet Field[ example::TextField;
FTPeek_DownloadFileToField("My File.txt") ]
remoteSourcePath
- the file path on the remote server to downloadencoding
- optional text encoding. Some of the supported encodings are "ASCII", "ISO8859_1", "UTF8", "UTF-16"
, for more supported encodings consult Java supported encodings use the second column of the table as the encoding name.temp
, calling the FTPeek_GetCurrentDir function will return /temp/
.
remotePath
- remote file path to get info for.infoType
- Can be either size
, which returns the file size in bytes, or moddate
, which returns a Date field with the modification date of the file.remoteDir
- the path of the directory to look in, or empty for the current working directoryhost
- address of the server; can be numeric IP address like "127.0.0.1"
or a named one like "ftp.mysite.com"
"ERROR"
, call this function to get a user-presentable description of what went wrong. For example,
If[ FTPeek_ConnectFTP( "ftp.domain.com"; "username"; "password" ) = "ERROR" ] Show Custom Dialog[ "Could not connect to FTP Server: " & FTPeek_LastError ] Exit Script End If
null
if there was no error.
Here is an example:
Set Variable [ $result ; FTPeek_MakeDir( "New Folder" ) //relative path example ] Set Variable [ $result ; FTPeek_MakeDir( "/home/files/newDir" ) //absolute path example]
remoteDir
- remote directory path to createlicenseKey
- registration keyregisteredTo
- register to entityfrom
- old file name to rename fromto
- new file name to rename toSet Field[ example::localFilesList;on Mac OS X will set the field example::localFilesList to a return separated list of files, such as
FTPeek_ScanLocalDirectory( "/Library/User Pictures/Animals", 0 ) ]
Butterfly.tif Cat.tif Dog.tif Dragonfly.tif Jaguar.tif Parrot.tif ...etcCalling this function on Windows:
Set Field[ example::localFilesList;will set example::localFilesList to
FTPeek_ScanLocalDir( "C:\WINDOWS\Media"; 0 ) ]
chimes.wav chord.wav ding.wav flourish.mid notify.wav onestop.mid recycle.wav ringin.wav ringout.wav start.wav tada.wav town.mid ...etc
Directories will end in a '/' on Mac OS X or '\' on Windows.
localPath
- path of the local folder to scanisPathFromFileMaker
- Set to 1 if localPath is a FileMaker-style path, returned from a FileMaker path function such as Get( DesktopPath ) or Get( TemporaryPath ). Set it to 0 if localPath is a native operating system path. For example, the file-style path to the user's desktop returned by Get( DesktopPath ) is '/Macintosh HD/Users/jesse/Desktop/', where the normal OS X path would be '/Users/jesse/Desktop'.showProgressFlag
- 0 to suppress progress bars, 1 to show progress bars.type
- Set to "ASCII"
to transfer plain text data and files; set to "BINARY"
for all non plain text data and files; set to "DEFAULT"
to have FTPeek resume making automatic implicit decisions on the transfer type.Please see the note on relative and absolute paths at the top of the page for more information. localSourcePath can be a system specific file path or a URL. ( ex. http://serverAddress/sample.mov ).
Here is an example of how to upload a file into the current working directory on the FTP server, retaining the same name as the source file:
If[ FTPeek_UploadFile( "", "/Library/Desktop Pictures/Lines Blue.jpg" ) = "ERROR" ] Show Custom Dialog[ "Could not upload file"; FTPeek_LastError ] End If
remoteDestPath
- remote file or dir path to upload to; will be created if directory structure does not exist; if empty current working directory will be usedlocalSourcePath
- local file path to uploadFTPeek_SetTransferType( type )
. If the directory structure to upload to does not exist on the
remote server, it will be created as necessary. If the remote file name is not specified ( remoteDestPath ends with a '/' slash character ),
the remote file will be named the same as the local file. Only ASCII characters are supported for file names. The remoteDestPath path can be relative or absolute.
remoteDestPath
- remote file or dir path to upload to; will be created if directory structure does not existcontainerToUpload
- container data to uploadUntitled.txt
. Only ASCII characters are supported for file names. The remoteDestPath path can be relative or absolute.
*Note that the default ftp transfer type is BINARY
remoteDestPath
- remote file or dir path to upload to; will be created if directory structure does not exist, will use current directory if empty.textFieldToUpload
- text data to uploadencoding
- optional text encoding. Some of the supported encodings are "ASCII", "ISO8859_1", "UTF8", "UTF-16"
, for more supported encodings consult Java supported encodings use the second column of the table as the encoding name.