1 2 Previous Next 15 Replies Latest reply on Jul 1, 2017 10:32 AM by gofmp15

    New CuRL Function and FTP

    GuenterBorg

      Is it possible to make a FTP upload with new CuRL Functions in FM16 ? And how to do this ?

       

      thx

       

      Günter

        • 1. Re: New CuRL Function and FTP
          Mike Duncan

          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 helps
          Mike

          2 of 2 people found this helpful
          • 2. Re: New CuRL Function and FTP
            beverly

            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

            4 of 5 people found this helpful
            • 3. Re: New CuRL Function and FTP
              fmpdude

              beverly wrote:

               

              Insert From URL allows these protocols:

              http, https, ftp, ftps, and file

               

              I did not know all those were supported.

               

              Nice!

              • 4. Re: New CuRL Function and FTP
                beverly

                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).

                 

                beverly

                • 5. Re: New CuRL Function and FTP
                  ThinkSoft

                  Sadly - no - this didn't help as it didn't show an example.

                  • 6. Re: New CuRL Function and FTP
                    ThinkSoft

                    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?

                    • 7. Re: New CuRL Function and FTP
                      wimdecorte

                      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.

                      1 of 1 people found this helpful
                      • 8. Re: New CuRL Function and FTP
                        beverly

                        FTPS (secure) is also supported with FM16 cURL.

                        • 9. Re: New CuRL Function and FTP
                          ThinkSoft

                          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

                          • 10. Re: New CuRL Function and FTP
                            wimdecorte

                            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.

                            2 of 2 people found this helpful
                            • 11. Re: New CuRL Function and FTP
                              fmpdude

                              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.

                              • 12. Re: New CuRL Function and FTP
                                bigtom

                                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.

                                 

                                I tried:

                                "--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.

                                5 of 5 people found this helpful
                                • 13. Re: New CuRL Function and FTP
                                  oettelshoven

                                  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!

                                   

                                  I would like to add two things that may be helpful:

                                  1

                                  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"

                                   

                                  2

                                  Another problem for me was the correct addressing of the host. My host name is something like:

                                  www.mysite.com

                                  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:

                                  ftp://www.mysite.com/myfolder/myFilename.jpg

                                  1 of 1 people found this helpful
                                  • 14. Re: New CuRL Function and FTP
                                    bigtom

                                    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:

                                    1

                                    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"

                                    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.

                                     

                                    2

                                    Another problem for me was the correct addressing of the host. My host name is something like:

                                    www.mysite.com

                                    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:

                                    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.

                                    2 of 2 people found this helpful
                                    1 2 Previous Next