Jump to content
Server Maintenance This Week. ×

Filemaker and OSX ftp


This topic is 6605 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hello all,

i am trying to build a small database which enables the user to up or download pictures he stored inside of a container field to a specified ftp server directory. while i know there is a nice plugin which can probably do that, i hope i can make use of OSx internal ftp command, connected with applescript. Can anyone maybe give me a headstart on how to accomplish this?

thanks a lot,

overrider

Link to comment
Share on other sites

You can upload a file using either "ftp" or "curl" with ftp. I've used the latter. The main problem is figuring the entire path to the folder/file you want to end up. You can use AppleScript and the 'do shell script' command, in a FileMaker Perform AppleScript step. The AppleScript looks like this (all 1 line):

do shell script "curl -T " & (quoted form of POSIX path of "path:to:image.gif") & " " & "ftp://user:[email protected]/path/image.gif"

The (quoted form of POSIX path of "path:to:image.gif") is just a syntax conversion from the old Mac path style (:) to the new Unix file path syntax (/). The "quoted form of" takes care of spaces, etc.. You can just use a Unix style path instead.

do shell script "curl -T 'Users/fej/Desktop/file.ext' 'ftp://user:[email protected]/path/image.gif'"

I put single quotes to do the quoted part, as do shell script requires the double quotes. Alternatively, since you're in AppleScript, you can set the paths into variables, then just use those in the command; it's more lines, but less messy in a way.

set fileToFTP to quoted form of (POSIX path of (choose file)) -- a Mac path converted to Unix path

set fileFTP to quoted form of "ftp://user:[email protected]/path/image.gif"

do shell script "curl -T " & fileToFTP & " " & fileFTP

(space after the -T, space between the 2 file path AppleScript variables)

The 2 file paths can come from FileMaker fields, ie.:

set fileToFTP to cell "fileToFTP"

set fileFTP to cell "fileFTP"

You might want to still do the quoted bit, if you have spaces in the paths, ie.;

set fileToFTP to quoted form of fileToFTP

I've had problems trying to do it all in one step. FileMaker doesn't seem to like (maybe more () would help?):

set fileToFTP to quoted form of cell "fileToFTP"

If you can get the complete path of a file on your server then you can reproduce it.

Edited by Guest
quoted form of (good night)
Link to comment
Share on other sites

This topic is 6605 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.