FTPUpload ( URL ; user ; password ; directory ; file ; localdirectory ; localfile )
Function to Upload file using curl and applescript
Average rating: 4.1 (46 votes) Log in to vote
Alan Deffenderfer - Show more from this author
ABD Enterprises https://www.abdenterprises.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Use the perform applescript script step with this function to perform ftp uploads. I use globals/variables that reference my paths/filenames and your username/password.
Comments
Xavi, Barcelona, Spain Jan 10, 2012 |
||
Does it works with windows? or it's only Mac? | ||
Richard, Portland, OR Jan 20, 2012 |
||
Keep getting "expected "" but found unknown token" error. Can't find a solution online. | ||
Jim Calhoun, Chicago Aug 13, 2012 |
||
Will this work with windows? | ||
lassoguy, www.ganahlconsulting.com Nov 26, 2012 |
||
This is a Mac only solution. Does not work with Windows. | ||
Valentin, Ithaca, NY Dec 10, 2013 |
||
Thank you for this great tool! I just used it successfully, very helpful! It seems that curl has a problem with white spaces though, i. e. if you have a folder or file with a safe in the name you will get the error Richard mentioned above. the solution is to put the entire local folder and file path in single quotes. So add a single quote ( ' ) w/o the parenthesis right after " curl -T ' " and before ftp.. " ' ftp://...". That should make it universal for every file and folder! /* Use the perform applescript script step with this function to perform ftp uploads. Set globals/variables that reference your paths/filenames and username/password and pass these to the function. Alan @ ABD */ "do shell script \"curl -T '" & Case( not IsEmpty( localdirectory ); localdirectory ) & localfile & "' ftp://" & user & ":" & password & "@" & URL & "/" & Case( not IsEmpty(directory); directory & "/") & file & "\"" |
||
Bryan, USA Apr 10, 2014 |
||
How to Set globals/variables that reference your paths/filenames and username/password and pass to the function. "do shell script \"curl -T '" & Case( not IsEmpty( localdirectory ); localdirectory ) & localfile & "' ftp://" & user & ":" & password & "@" & URL & "/" & Case( not IsEmpty(directory); directory & "/") & file & "\"" |
||
Ingo, Vienna/Austria Apr 7, 2015 |
||
It works great. Thanks! Ingo |
||
Brian McIntosh, Korora Jan 23, 2016 |
||
I want to run this script/function scheduled on Filemaker Server. What needs to be done with the local directory for FMS to be able to access the file for upload. I am led to believe that FMS can not access the Desktop of the server for files. | ||
Nick, Sussex UK Feb 25, 2016 |
||
The best way to ensure that type of script using CURL under Applescript or Windows events works as expected is to use the Filemaker function GetAsURLEncoded () encode the inputs, then characters which are illegal in a URL will not stop your Curl command from functioning. A second useful item when debugging CURL is this form which returns to you what the FTP server received: curl --trace -n -v -ssl -l ftp://<username>:<password>@<svr IP address>/<folder>/<file.html> In DeskspaceCMS, we trap for an error on upload and if one occurs we pass the output of this CURL command back to the user in a dialogue so they can work out where they went wrong. Nick Lightbody: Sussex UK |
||
Alan Deffenderfer, ABD Enterprises Feb 25, 2016 |
||
I wrote this Mac Only custom function over ten year ago and posted almost that long ago. I'm glad some of you have found it helpful. When I get some time in the coming weeks, I'll update it based on the comments above. Thanks for all the feedback. Alan @ ABD |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.