Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I've been trying for 3 days to figure out the syntax for an FTP Upload custom function (downloaded from briandunning.com), but I can't get it to work. It always fails with error -2740, "an unknown token can't go here," which tells me nothing. Anyone care to check out my script and offer some pointers? I'm sure there's a syntax error, but I can't find it. I want to hard-code the username and password, but the password contains special characters (parentheses), and I'm not sure how to escape them:

i,e, ythr(i.K9)56

I've tried various escaping approaches: ythr(i.K9)56 , "ythr" & "(" & "i.K9" & ")" & "56", etc.

FTPUpload (path, directory, file)






"

set thePath to quoted form of "ftp://<username>:<password>@ftp.remotehost.com/targetfolder/"



do shell script "curl -T"  path & "/" & directory & "/" & file thePath



"



Any ideas?

Posted

Do you have a working AppleScript? That is one that works when run from AppleScript Editor?

---

P.S. Could I please ask you to change your avatar? It's very distracting.

Posted

Haven't posted in a while, so the first thing I thought was "I wonder how many people are going to post to ask me to change my avatar?

Actually, the entire script step is

Perform Applescript (calculated)

FTPUpload($path, $directory, $file)

where $path, $directory and $file are local variables

Posted (edited)

I suggest you step away from the custom function and do some experimenting in AppleScript Editor or directly in the terminal until you find out what kind of escaping is necessary and acceptable in cURL. Until then, this is not a Filemaker or even AppleScript issue.

I suspect that as long as your password doesn't contain quotes, colons or at signs, it shouldn't need any escaping. But that's merely a guess.

Edited by comment
Posted

I wonder how many people are going to post to ask me to change my avatar

I had the same concern as you, and was waiting to see if anyone actually did reply, as I tagged your post for follow-up in case no one did, and to see what others had to say about it. Personally I couldn't concentrate on your question with your avatar on-screen, maybe others had the same problem.

I'm curious as to why you would use it when you, yourself, thought it was over the top?

Lee

  • Newbies
Posted

Just use a simple shell script, see the code below:

Enjoy!

-----------------

#!/bin/sh

ftpserver="ftp.server.com"

remotepath="Import"

ftplogin="myuserid"

ftppass="mypass"

function ftpfile {

ftp -n $ftpserver <<INPUT_END

quote user $ftplogin

quote pass $ftppass

cd $remotepath

prompt off

mput TheFile2BUploaded.csv

exit

INPUT_END

}

ftpfile

exit

---------

This topic is 4686 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.