Is it possible to make a FTP upload with new CuRL Functions in FM16 ? And how to do this ?
You should be able to. FTP options are included in the supported curl options, found here:
FileMaker Pro 16 Help
However, I wouldn't recommend FTP, since it is not secure and can be finicky. You will also need to reference the file with a variable, instead of referencing from the file system. I recently wrote a blog post showing how to do that with a web server. You can find that here:
FileMaker 16: cURL and Container Fields | Soliant Consulting
Hope that helpsMike
Insert From URL allows these protocols:
http, https, ftp, ftps, and file
The cURL options are found here:
Examples of using cURL to FTP (& FTPS) are likely available for other systems. Just set up the script step correctly.
See this handy "form" for posting cURLs:
"cURL options - no need to remember the syntax"
beverly wrote: Insert From URL allows these protocols:http, https, ftp, ftps, and file
I did not know all those were supported.
FileMaker 15 help:
Insert From URL supports http, https, httppost, httpspost, ftp, ftps, and file protocols.
In FM 16 the httppost and httpspost is handled by the cURL options.
The Insert From URL script step goes back to FM 12.0, but I don't know right off-hand how it handles cURL in the versions 12-14 (there is documentation on these older versions if the help topics on the version one uses is not sufficient).
Sadly - no - this didn't help as it didn't show an example.
The example application of cURL options no need to remember was packaged as a zip file and although the functions appear in the custom functions; the application is startlingly bizarre with no instructions and no functionality.
Does anyone actually have a working example of an FTP upload using the cURL arguments?
ThinkSoft wrote: The example application of cURL options no need to remember was packaged as a zip file and although the functions appear in the custom functions; the application is startlingly bizarre with no instructions and no functionality.
That file is meant as a library for the custom functions to make using cURL options easier by not having to remember the cURL syntax. It is not meant to as a worked-out tutorial.
FTPS (secure) is also supported with FM16 cURL.
Many thanks - that wasn't obvious.
Still - having battled with the cURL options all afternoon - I'm no nearer being able to upload to an FTP site.
I can use the cURL functions quite happily from Terminal - but I must be missing something as the same commands are (seemingly) ignored in FM16.
Any pointers would be gratefully received
We'd have to see what you have so far I think.
The most common issue may be that you are trying to upload a file that is in your hard disk? That won't work. For security reasons FM will only let you upload data that is in a container field.
You could easily upload any file using a text field and a button if you use a service from FMP.
It would work like this:
1. You have a file path in a text field.
2. You click a button that runs a script in FMP.
3.That script calls UPDATE FROM URL, passing the file path to the service.
4. The service (Java) would FTP that file on your computer to an FTP(S) site.
5. You're done.
You could then even use that service from Terminal, the browser, too.
Not sure if this idea sounds compelling or useful, but using a service with FMP is how I augment FMP to do exactly what I want with few restrictions.
HOPE THIS HELPS.
I am with OP on this one. Documentation for many things FM is not so good. This was one of them. I managed to do all kinds of wonderful things with the new cURL options, but I could not seem to figure out how to ftp upload a file.
"--user user:pass -T $file"
"--user user:pass -T @$file"
"--user user:pass -T" & $file
"--user user:pass -T" & @$file
The "--user user:pass" worked when downloading files via ftp so I knew the authentication was working.
Final solution was attained with the following:
The file needs to be in a container and the variable needs to be set to the container. A file on the client file system or a direct URL cannot be used as wimdecorte mentioned.
A destination file name must be specified in the URL. It will not automatically append the $file filename.
"<hostname>/dir/file.ext" or "<hostname>/dir/" & GetContainerAttribute(Container; "filename") or similar needs to be used.
The basic syntax for the cURL options is "--user user:pass -T $file". Not intuitive use of a FM variable in quoted text but this works.
Hope this helps. The other ftp options for SSL and such are up to you and straight forward.
thank you, thank you, thank you, thank you, thank you, thank you.
I have spent some 2 weeks on this without success. After reading your text it works!
I would like to add two things that may be helpful:
Although the strange behavior of the use of the variables is working on the -T-item ($file), it fails with the user and password items. If you store the values for these in variables you must write:
"--user " & $usr & ":" & $pw & " -T $file"
Another problem for me was the correct addressing of the host. My host name is something like:
In order to get ftp-connected the host must start with ftp:// even if the name starts with www.
So the whole string in the URL section of the fm dialog would look like:
oettelshoven wrote: bigtom,thank you, thank you, thank you, thank you, thank you, thank you.I have spent some 2 weeks on this without success. After reading your text it works!
Glad it helped.
I would like to add two things that may be helpful:1Although the strange behavior of the use of the variables is working on the -T-item ($file), it fails with the user and password items. If you store the values for these in variables you must write:"--user " & $usr & ":" & $pw & " -T $file"
This is true and why it is not intuitive. I did of course try "--user " & $usr & ":" & $pw & " -T" & $file. which did not work. I guess I should have included that in the list.
2Another problem for me was the correct addressing of the host. My host name is something like:www.mysite.comIn order to get ftp-connected the host must start with ftp:// even if the name starts with www.So the whole string in the URL section of the fm dialog would look like:ftp://www.mysite.com/myfolder/myFilename.jpg
This can really depend on the ftp host. you might find that ftp.mysite.com will work as well.
As an aside: if the file is stored in a FileMaker container it can be exported quite easily. Not sure if the container can be a global for one time use but may test this.
Also not sure if the export can be made to your ftp site...
However, I do use this to transfer fmp12 files from my laptop to my iPhone bypassing iTunes. I have a script that closes all open files in my development group, then creates a new record inserting a file into the container.
When this file is hosted I can download one or all of the files to my iphone.
GO now has the ability to manually transfer files between iCloud, Dropbox, etc and the iPhone and I do backups to these cloud sites while working on a local file.
I am also going round the bend with this issue.
Can you show your whole script please or at least the complete settings for the Insert Url step.
Where does the entire URL ftp://www.mysite.com/myfolder/myFilename.jpg that you specified go - Is that under the specify URL as I thought that was just the ftp site to be logged into.
Or is is the filename that is to be transfered ?? My brian hurts.
OK, I'll try to make this clear although my FM interface is German.
The options dialog of the URL function has 3 checkboxes of which the 3rd ist target (I suppose).
This one has 3 options (from top to bottom):
output value (result), e.g. error code:
invent any variable.
This is the complete path to the server's destination file:
This is also the place where you name the file being uploaded.
The cURL string:
"--user " & $usr & ":" & $pw & " -T $uploadFile"
where $uploadFile is set from a container field with your upload-file in it (no matter what's its name).
In case you upload a text file be sure to put a correct encoded text (see the new FM function for this!) into the container field.
This is what works for me.
Hope it helps.
Retrieving data ...