14 Replies Latest reply on Jan 24, 2017 10:51 PM by CICT

    Upload File From Container To S3

    jsorge

      I'm trying to find a way to upload a file from a container (most of the time these will be images) to Amazon S3 and get returned the URL to the file. Amazon has a pretty confusing API with lots of options. I'm hoping that I don't have to reinvent the wheel. Has anyone done this successfuly? Thanks!

      jared

        • 1. Re: Upload File From Container To S3
          LSNOVER

          What's the communication syntax for connecting to the S3 server?

          • 2. Re: Upload File From Container To S3
            jsorge

            Amazon has lots of options available. There's Java, Groovy, cURL, PHP, but they're pretty confusing to use. I was hoping that I wasn't the first one to attempt this. Looks like there's no code out there yet for our corner of the world.

            • 3. Re: Upload File From Container To S3
              PeterWindle

              I stuggled with this one for ages, almost a year, in fact...

               

              Beezwax have a plugin which is supposed to have done this. I had problems with it and NEVER got the support I needed.

               

              I tried other php plugins etc, never got anywhere.

               

              I tried the Java/groovy thing, as jsorge pointed out, it't not easy, I did not get anywhere with these...

               

              Keep in mind, I know nothing about php NOR Java, however, getting any help with these where difficult.

               

               

              So, what I ended up doing is to get a web developer to design a php script that accepted a Base64 file and it pushed it to the S3 bucket. The php contained all the settings for the bucket, so all I had to do is to post a Base64 file of the image to the php. Note: There is plenty of documentation on Amazon's developer site on how to create the php script.

               

               

              I can hear you ask: "But, how the heck did you get the Base64 from a container field?" Well, after months of searching and waiting, I was lucky enough to find the BaseElements plugin from goya.com.au - what an awesome tool. Converted the contents of a container field to Base64, then used the same plugin to perform a POST to the web based php script, YAY! "There's a file in my bucket, dear liza"...

               

              So, if you need the php script, I could possibly get a copy, but it belongs to my client, so he may as for a fee. The Base Elements plugin is FREE (they as for 'sponsors', I beleive) The FileMaker side of things is a piece of cake, once you have the plugin.

               

              Let me know how you go... as I said, this took me almost a year to get it happening, so I think this is possibly the quickest and easiest way to do it, I think I could have just saved you a lot of heartache !

              • 4. Re: Upload File From Container To S3
                jsorge

                Thanks Peter. I had a hunch that I was banging my head against the wall. I found a good open source S3 PHP class at https://github.com/tpyo/amazon-s3-php-class and I'll just use that and put it on our server.

                jared

                • 5. Re: Upload File From Container To S3
                  jsubiros

                  Hello.

                  I know this post has 3 years already.... but I am trying to solve a solution to upload files to my S3 with FileMaker and BaseElements plug-in, but still cannot do it. Specially I have a lot of problems calculating the signature.

                  This is the example I found...

                   

                  https://s3.amazonaws.com/examplebucket/test.txt

                  ?X-Amz-Algorithm=AWS4-HMAC-SHA256

                  &X-Amz-Credential=<your-access-key-id>/20130721/us-east-1/s3/aws4_request

                  &X-Amz-Date=20130721T201207Z

                  &X-Amz-Expires=86400

                  &X-Amz-SignedHeaders=host

                  &X-Amz-Signature=<signature-value>

                   

                  Can you help me ??

                  Thanks.

                  • 6. Re: Upload File From Container To S3
                    nickorr

                    jsubiros,

                     

                    It's a bit hard to help you, you haven't give us much information   What have you tried, and what is working and what isn't?  What results do you get?

                     

                    Cheers,

                    Nick

                    • 7. Re: Upload File From Container To S3
                      jsubiros

                      What I am trying is to do 2 different things.

                      First is to upload files using FileMaker with baseelements plugin. Second one, to get the url to download them.

                       

                      I am trying to understand de documentation API of S3:

                      See -> Amazon S3 REST API Introduction - Amazon Simple Storage Service

                       

                      Also I tried to develope the signature, as Matt Petrowsky said here:

                      fmpstandards/S3Url.fmfn at master · petrowsky/fmpstandards · GitHub

                       

                      At the end I ever take the same mistake -> the signature is not correct.

                      I am losing a project because of this, and the customer will do it with php, instead of FileMaker.

                       

                      Thanks for all.

                      • 8. Re: Upload File From Container To S3
                        jsubiros

                        Hello, did you see my post ?

                         

                        Thanks.

                        • 9. Re: Upload File From Container To S3
                          nickorr

                          That doesn't really help.  What have you built in FileMaker?  You mean the signature is not correct, what code have you written, what's the response?

                           

                          To help you we need specifics, actual code from FileMaker and expected result vs actual result.

                           

                          Cheers,

                          Nick

                          • 10. Re: Upload File From Container To S3
                            CICT

                            You may find this thread helpful: Windows Server offsite backups options

                             

                            A number of people chipped in to the above and, as a result, we now upload daily from Windows servers to S3 using the AWS API launched by Filemaker Server system scripts. S3 browser works well for Windows users for uploading/downloading files manually and for Macs we really like Transmit Panic - Transmit - The ultimate Mac OS X FTP + SFTP + S3 app  as, like S3 browser, they both support external buckets that massively simplify our S3 configuration, whereas CyberDuck doesn't. Also for Macs ExpanDrive is also worth a look, but Transmit ticked all the boxes for us.

                             

                            Regards

                            Andy

                            • 11. Re: Upload File From Container To S3
                              jcramirezcelis

                              Hi

                               

                              Has anyone have been able to develop a Filemaker script to upload documents stored on a Container into AWS S3 bucket ?

                              • 12. Re: Upload File From Container To S3
                                andywalz

                                Yes. Using BaseElement Plugin and the AWS CLI you can write a FileMaker Script that uploads documents to S3 that works cross-platform and via PSoS. See: s3 — AWS CLI 1.11.36 Command Reference

                                • 13. Re: Upload File From Container To S3
                                  coherentkris

                                  AndyWalz

                                   

                                  Do you have details on how to do this from FMS?

                                  I need to bulk upload 10000+ fotos to s3.

                                  • 14. Re: Upload File From Container To S3
                                    CICT

                                    Just in case this helps, albeit without the BaseElement plugin and this is for a Windows server only:

                                     

                                    The following assumes you have an S3 bucket, user and access keys setup.

                                     

                                    Install the AWS CLI from:

                                    https://aws.amazon.com/getting-started/tutorials/backup-to-s3-cli/ (includes setup steps and includes the following link)

                                         https://s3.amazonaws.com/aws-cli/AWSCLI64.msi (links the installer for 64bit server)

                                     

                                    Run the AWSCLI64 installer

                                    Launch the command line run as administrator

                                              Type:

                                                  aws configure

                                                  then Enter

                                                  Paste the Access Key ID for the S3 user

                                                  then Enter

                                                  Paste the Secret Access Key for the S3 user

                                                  Default region name:

                                                      (e.g. Ireland in normal text format, not eu-west1, which is required in the batch file below)

                                              then Enter

                                              json

                                              then Enter

                                     

                                    Save a batch file using Notepad (.bat - not as a text file) in Programs\FileMaker Server\Data\Scripts\ folder containing:

                                     

                                    set AWS_ACCESS_KEY_ID=YourAccessKey
                                    set AWS_SECRET_ACCESS_KEY=YourSecretAccessKey
                                    set AWS_DEFAULT_REGION=(InTheForm)eu-west1(for Ireland as an example)
                                    aws s3 sync C:\Your\Windows\Location\Of\Your\Files s3://S3BucketName/SubFolder/Path/ --delete

                                     

                                    Only use the --delete if wanting to synchronise the contents of both folders

                                     

                                    Use a FileMaker Server system script schedule to run this, you may need to enter the server administrator name to run the system script, if you wish to have it run routinely. Otherwise you can just double click the batch file and the command line will display any errors or the file copying status.

                                     

                                    Regards

                                    Andy

                                    1 of 1 people found this helpful