MBS FileMaker Plugin Example Databases

Amazon S3 Upload File

All examples are included with download of MBS FileMaker Plugin.

Amazon S3 Upload File.fmp12

Overview
Tables1
Relationships0
Layouts1
Scripts6
Value Lists0
Custom Functions0
Custom Menus33
File Options
Default custom menu set[Standard FileMaker Menus]
When opening file
Minimum allowed version12.0
Login usingAccount Name; Account= Admin
Allow user to save passwordOff
Require iOS passcodeOff
Switch to layoutOff
Hide all toolbarsOff
Script triggers
OnFirstWindowOpenOff
OnLastWindowCloseOff
OnWindowOpenOff
OnWindowCloseOff
OnFileAVPlayerChangeOff
Thumbnail Settings
Generate ThumbnailsOn; Temporary

 

Tables

Table Name
Statistics
Occurrences in Relationship Graph
CURL Test
11 fields defined, 1 record
CURL Test

Fields

Table Name: CURL Test - 11 Fields
Field NameTypeOptionsCommentsOn LayoutsIn RelationshipsIn ScriptsIn Value Lists
ResultNormal, TextAuto-Enter:
  • Allow editing
Validation:
  • Only during data entry
Storage:
  • Repetitions: 1
  • Indexing: None
  • Automatically create indexes as needed
  • Index Language: German
      ImageNormal, BinaryAuto-Enter:
      • Allow editing
      Validation:
      • Only during data entry
      Storage:
      • Repetitions: 1
          headerNormal, TextAuto-Enter:
          • Allow editing
          Validation:
          • Only during data entry
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
                debugNormal, TextAuto-Enter:
                • Allow editing
                Validation:
                • Only during data entry
                Storage:
                • Repetitions: 1
                • Indexing: None
                • Automatically create indexes as needed
                • Index Language: German
                    FilePathNormal, TextAuto-Enter:
                    • Allow editing
                    Validation:
                    • Only during data entry
                    Storage:
                    • Repetitions: 1
                    • Indexing: None
                    • Automatically create indexes as needed
                    • Index Language: German
                        Access Key IDNormal, TextAuto-Enter:
                        • Allow editing
                        Validation:
                        • Only during data entry
                        Storage:
                        • Global
                        • Repetitions: 1
                        • Index Language: German
                            Access Key SecretNormal, TextAuto-Enter:
                            • Allow editing
                            Validation:
                            • Only during data entry
                            Storage:
                            • Global
                            • Repetitions: 1
                            • Index Language: German
                                RegionNormal, TextAuto-Enter:
                                • Allow editing
                                Validation:
                                • Only during data entry
                                Storage:
                                • Global
                                • Repetitions: 1
                                • Index Language: German
                                    BucketnameNormal, TextAuto-Enter:
                                    • Allow editing
                                    Validation:
                                    • Only during data entry
                                    Storage:
                                    • Global
                                    • Repetitions: 1
                                    • Index Language: German
                                        URLNormal, TextAuto-Enter:
                                        • Allow editing
                                        Validation:
                                        • Only during data entry
                                        Storage:
                                        • Repetitions: 1
                                        • Indexing: None
                                        • Automatically create indexes as needed
                                        • Index Language: German
                                            OutputNormal, TextAuto-Enter:
                                            • Allow editing
                                            Validation:
                                            • Only during data entry
                                            Storage:
                                            • Repetitions: 1
                                            • Indexing: None
                                            • Automatically create indexes as needed
                                            • Index Language: German

                                                Layout Objects: CURL Test

                                                Regular Fields

                                                Field Name: CURL Test::Result
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 98 pt
                                                • Left: 579 pt
                                                • Bottom: 112 pt
                                                • Right: 952 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: System Default
                                                • Go to next field using: Tab key
                                                Yes

                                                Field Name: CURL Test::Image
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 61 pt
                                                • Left: 116 pt
                                                • Bottom: 160 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: System Default
                                                • Go to next field using: Tab key
                                                No

                                                Field Name: CURL Test::debug
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 124 pt
                                                • Left: 579 pt
                                                • Bottom: 390 pt
                                                • Right: 952 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: System Default
                                                • Go to next field using: Tab key
                                                Yes

                                                Field Name: CURL Test::FilePath
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 194 pt
                                                • Left: 116 pt
                                                • Bottom: 254 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                Yes

                                                Field Name: CURL Test::Access Key ID
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 552 pt
                                                • Left: 116 pt
                                                • Bottom: 566 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                No

                                                Field Name: CURL Test::Access Key Secret
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 570 pt
                                                • Left: 116 pt
                                                • Bottom: 584 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                No

                                                Field Name: CURL Test::Region
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 588 pt
                                                • Left: 116 pt
                                                • Bottom: 602 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                No

                                                Field Name: CURL Test::Bucketname
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 606 pt
                                                • Left: 116 pt
                                                • Bottom: 620 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                No

                                                Field Name: CURL Test::URL
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 486 pt
                                                • Left: 116 pt
                                                • Bottom: 500 pt
                                                • Right: 369 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                Yes

                                                Field Name: CURL Test::Output
                                                Field PropertiesCoordinatesField FormatField BehaviorQuick Find
                                                • Top: 396 pt
                                                • Left: 579 pt
                                                • Bottom: 513 pt
                                                • Right: 952 pt
                                                • Anchoring: Left, Top
                                                Field Format:
                                                • Edit Box
                                                Field Behavior:
                                                • Allow field to be entered: In Find mode, In Browse mode
                                                • Touch keyboard type: Default for Data Type
                                                • Go to next field using: Tab key
                                                Yes

                                                Group Buttons

                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Trace on
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 61 pt
                                                • Left: 844 pt
                                                • Bottom: 86 pt
                                                • Right: 961 pt
                                                • Anchoring: Left, Top
                                                Set Variable [ $result; Value:MBS("Trace") ]

                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Import File
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 61 pt
                                                • Left: 392 pt
                                                • Bottom: 87 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Perform Script [ “Import File” ]

                                                Scripts:


                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Upload Container
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 98 pt
                                                • Left: 392 pt
                                                • Bottom: 124 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Perform Script [ “Upload Container” ]

                                                Scripts:


                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Select File
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 194 pt
                                                • Left: 392 pt
                                                • Bottom: 220 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Perform Script [ “Select File” ]

                                                Scripts:


                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Upload File
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 228 pt
                                                • Left: 392 pt
                                                • Bottom: 254 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Perform Script [ “Upload File” ]

                                                Scripts:


                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Open URL
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 486 pt
                                                • Left: 392 pt
                                                • Bottom: 512 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Open URL [ CURL Test::URL ] [ No dialog ]

                                                Fields:


                                                Button PropertiesCoordinatesScript/Script Step
                                                  Type:
                                                • Text: Upload Big File
                                                  Additional Properties:
                                                • Change to hand cursor over button
                                                • Rectangular
                                                • Top: 262 pt
                                                • Left: 392 pt
                                                • Bottom: 288 pt
                                                • Right: 509 pt
                                                • Anchoring: Left, Top
                                                Perform Script [ “Upload Big File” ]

                                                Scripts:


                                                Script Hierarchy

                                                Upload Container
                                                Upload File
                                                Upload Big File
                                                Select File
                                                Import File
                                                Clear

                                                Next Script: [Upload File]
                                                Script NameUpload Container
                                                Run script with full access privilegesOff
                                                Include In MenuYes
                                                Layouts that use this script
                                                Scripts that use this script
                                                  Script Definition
                                                  Script Steps
                                                  • #get global settings
                                                  • Set Variable [ $AWSAccessKeyId; Value:CURL Test::Access Key ID ]
                                                  • Set Variable [ $AWSSecretAccessKey; Value:CURL Test::Access Key Secret ]
                                                  • Set Variable [ $Region; Value:CURL Test::Region ]
                                                  • Set Variable [ $Bucketname; Value:CURL Test::Bucketname ]
                                                  • #What do we want to do? PUT file to S3!
                                                  • Set Variable [ $Filename; Value:MBS( "Path.LastPathComponent"; GetAsText(CURL Test::Image) ) ]
                                                  • Set Variable [ $Service; Value:"s3" ]
                                                  • Set Variable [ $Verb; Value:"PUT" ]
                                                  • #Keep those empty for default
                                                  • Set Variable [ $Domain; Value:"" ]
                                                  • Set Variable [ $HashedPayload; Value:"" // automatic ]
                                                  • Set Variable [ $Headers; Value:"x-amz-acl: public-read" ]
                                                  • #Build a path
                                                  • Set Variable [ $Path; Value:"/" & $BucketName & "/" & MBS( "Text.EncodeURLComponent"; $Filename; "utf8") ]
                                                  • If [ $region = "us-east-1" ]
                                                  • Set Variable [ $URL; Value:"https://" & "s3.amazonaws.com" & $path ]
                                                  • Else
                                                  • Set Variable [ $URL; Value:"https://" & "s3" & "-" & Lower($region) & ".amazonaws.com" & $path ]
                                                  • End If
                                                  • #Setup dialog
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.Reset") ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "Uploading...") ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Amazon S3 Upload") ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Uploading " & $FileName) ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
                                                  • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                  • #run upload
                                                  • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                  • Set Variable [ $r; Value:MBS( "CURL.SetUpdateProgressDialog"; $curl; 1 ) ]
                                                  • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                  • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                  • Set Variable [ $r; Value:MBS("CURL.SetInputFile"; $curl; CURL Test::Image) ]
                                                  • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; $Verb; $HashedPayload; $Headers) ]
                                                  • If [ MBS("IsError") ]
                                                  • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                  • Else
                                                  • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                  • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                  • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                  • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                  • Set Field [ CURL Test::Result; $result ]
                                                  • Set Field [ CURL Test::Output; $output ]
                                                  • Set Field [ CURL Test::debug; $debug ]
                                                  • If [ $result = "OK" and $httpResponse = 200 ]
                                                  • Set Field [ CURL Test::URL; $URL ]
                                                  • Else
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                  • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                  • End If
                                                  • End If
                                                  • Set Variable [ $result; Value:MBS("CURL.Cleanup"; $curl) ]
                                                  • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                  Fields used in this script
                                                  Scripts used in this script
                                                    Layouts used in this script
                                                      Tables used in this script
                                                      Table occurrences used by this script
                                                      Custom Functions used by this script
                                                        Custom menu set used by this script

                                                          Previous Script: [Upload Container]Next Script: [Upload Big File]
                                                          Script NameUpload File
                                                          Run script with full access privilegesOff
                                                          Include In MenuYes
                                                          Layouts that use this script
                                                          Scripts that use this script
                                                            Script Definition
                                                            Script Steps
                                                            • #get global settings
                                                            • Set Variable [ $AWSAccessKeyId; Value:CURL Test::Access Key ID ]
                                                            • Set Variable [ $AWSSecretAccessKey; Value:CURL Test::Access Key Secret ]
                                                            • Set Variable [ $Region; Value:CURL Test::Region ]
                                                            • Set Variable [ $Bucketname; Value:CURL Test::Bucketname ]
                                                            • #What do we want to do? PUT file to S3!
                                                            • Set Variable [ $FilePath; Value:CURL Test::FilePath ]
                                                            • Set Variable [ $Filename; Value:MBS( "Path.LastPathComponent"; GetAsText($FilePath) ) ]
                                                            • Set Variable [ $Service; Value:"s3" ]
                                                            • Set Variable [ $Verb; Value:"PUT" ]
                                                            • If [ MBS("Files.FileExists"; $FilePath) = 0 ]
                                                            • Show Custom Dialog [ Title: "Invalid file path"; Message: "Are you sure this is a valid native file path?"; Default Button: “OK”, Commit: “Yes” ]
                                                            • Exit Script [ ]
                                                            • End If
                                                            • #Setup dialog
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.Reset") ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "Uploading...") ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Amazon S3 Upload") ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Uploading " & $FileName) ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
                                                            • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                            • #Keep those empty for default
                                                            • Set Variable [ $Domain; Value:"" ]
                                                            • Set Variable [ $HashedPayload; Value:Lower(MBS( "Hash.Digest"; "SHA256"; "Path"; $FilePath; ""; "hex"; "" )) ]
                                                            • Set Variable [ $Headers; Value:"x-amz-acl: public-read" ]
                                                            • #Build a path
                                                            • Set Variable [ $Path; Value:"/" & $BucketName & "/" & MBS( "Text.EncodeURLComponent"; $Filename; "utf8") ]
                                                            • If [ $region = "us-east-1" ]
                                                            • Set Variable [ $URL; Value:"https://" & "s3.amazonaws.com" & $path ]
                                                            • Else
                                                            • Set Variable [ $URL; Value:"https://" & "s3" & "-" & Lower($region) & ".amazonaws.com" & $path ]
                                                            • End If
                                                            • #run upload streaming from input file
                                                            • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                            • Set Variable [ $r; Value:MBS( "CURL.SetUpdateProgressDialog"; $curl; 1 ) ]
                                                            • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                            • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                            • Set Variable [ $r; Value:MBS("CURL.OpenInputFile"; $curl; $FilePath) ]
                                                            • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; $Verb; $HashedPayload; $Headers) ]
                                                            • If [ MBS("IsError") ]
                                                            • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                            • Else
                                                            • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                            • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                            • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                            • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                            • Set Field [ CURL Test::Result; $result ]
                                                            • Set Field [ CURL Test::Output; $output ]
                                                            • Set Field [ CURL Test::debug; $debug ]
                                                            • If [ $result = "OK" and $httpResponse = 200 ]
                                                            • Set Field [ CURL Test::URL; $URL ]
                                                            • Else
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                            • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                            • End If
                                                            • End If
                                                            • Set Variable [ $result; Value:MBS("CURL.Cleanup"; $curl) ]
                                                            • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                            Fields used in this script
                                                            Scripts used in this script
                                                              Layouts used in this script
                                                                Tables used in this script
                                                                Table occurrences used by this script
                                                                Custom Functions used by this script
                                                                  Custom menu set used by this script

                                                                    Previous Script: [Upload File]Next Script: [Select File]
                                                                    Script NameUpload Big File
                                                                    Run script with full access privilegesOff
                                                                    Include In MenuYes
                                                                    Layouts that use this script
                                                                    Scripts that use this script
                                                                      Script Definition
                                                                      Script Steps
                                                                      • #get global settings
                                                                      • Set Variable [ $AWSAccessKeyId; Value:CURL Test::Access Key ID ]
                                                                      • Set Variable [ $AWSSecretAccessKey; Value:CURL Test::Access Key Secret ]
                                                                      • Set Variable [ $Region; Value:CURL Test::Region ]
                                                                      • Set Variable [ $Bucketname; Value:CURL Test::Bucketname ]
                                                                      • #What do we want to do?
                                                                      • Set Variable [ $FilePath; Value:CURL Test::FilePath ]
                                                                      • Set Variable [ $Filename; Value:MBS( "Path.LastPathComponent"; GetAsText($FilePath) ) ]
                                                                      • Set Variable [ $Service; Value:"s3" ]
                                                                      • If [ MBS("Files.FileExists"; $FilePath) = 0 ]
                                                                      • Show Custom Dialog [ Title: "Invalid file path"; Message: "Are you sure this is a valid native file path?"; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • #Setup dialog
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Reset") ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetBottomText"; "Uploading...") ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTitle"; "Amazon S3 Upload") ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Initiate upload " & $FileName) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetButtonCaption"; "Cancel") ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetProgress"; -1) ]
                                                                      • If [ MBS( "Debugger.IsVisible" ) = 0 ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Show") ]
                                                                      • End If
                                                                      • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                                      • #Keep those empty for default
                                                                      • Set Variable [ $Domain; Value:$BucketName & ".s3.amazonaws.com" ]
                                                                      • Set Variable [ $Headers; Value:"x-amz-acl: public-read" ]
                                                                      • Set Variable [ $Query; Value:"uploads" ]
                                                                      • #Build a path
                                                                      • Set Variable [ $Path; Value:"/" & $BucketName & "/" & MBS( "Text.EncodeURLComponent"; $Filename; "utf8") ]
                                                                      • If [ $region = "us-east-1" ]
                                                                      • Set Variable [ $URL; Value:"https://" & "s3.amazonaws.com" & $path ]
                                                                      • Else
                                                                      • Set Variable [ $URL; Value:"https://" & "s3" & "-" & Lower($region) & ".amazonaws.com" & $path ]
                                                                      • End If
                                                                      • #Initiate
                                                                      • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; "POST"; ""; $Headers; $Query) ]
                                                                      • If [ MBS("IsError") ]
                                                                      • Set Variable [ $result; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                      • Exit Script [ ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionCustomRequest"; $curl; "POST" ) ]
                                                                      • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                      • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                                      • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                                      • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                                      • Set Field [ CURL Test::Result; $result ]
                                                                      • Set Field [ CURL Test::Output; $output ]
                                                                      • Set Field [ CURL Test::debug; $debug ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • If [ $result = "OK" and $httpResponse = 200 ]
                                                                      • Set Variable [ $UploadId; Value:MBS( "XML.GetPathValue"; $output; "InitiateMultipartUploadResult.UploadId") ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • End If
                                                                      • #upload parts
                                                                      • Set Variable [ $FileSize; Value:MBS( "Files.FileSize"; $FilePath ) ]
                                                                      • Set Variable [ $index; Value:0 ]
                                                                      • Set Variable [ $XML; Value:"<CompleteMultipartUpload></CompleteMultipartUpload>" ]
                                                                      • Set Variable [ $Headers; Value:"" ]
                                                                      • Set Variable [ $Offset; Value:0 ]
                                                                      • Set Variable [ $BlockSize; Value:1024*1024*5 ]
                                                                      • Set Variable [ $BlockCount; Value:($FileSize+$BlockSize-1) / $BlockSize ]
                                                                      • Set Variable [ $r; Value:MBS( "ProgressDialog.SetProgress"; 0 ) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Uploading " & $FileName) ]
                                                                      • Set Variable [ $cancel; Value:0 ]
                                                                      • Loop
                                                                      • Set Variable [ $partNumber; Value:$index + 1 ]
                                                                      • Set Variable [ $Headers; Value:"" ]
                                                                      • Set Variable [ $Query; Value:"partNumber=" & $partNumber & "&uploadId=" & $UploadId ]
                                                                      • Set Variable [ $HashedPayload; Value:"" ]
                                                                      • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.OpenInputFile"; $curl; $FilePath; $offset; $BlockSize) ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; "PUT"; $HashedPayload; $Headers; $Query) ]
                                                                      • If [ MBS("IsError") ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                      • Exit Script [ ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionCustomRequest"; $curl; "PUT" ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionUpload"; $curl; 1 ) ]
                                                                      • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                      • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                                      • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                                      • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                                      • Set Variable [ $Headers; Value:MBS( "CURL.GetHeaderAsText"; $curl; "UTF-8") ]
                                                                      • Set Field [ CURL Test::Result; $result ]
                                                                      • Set Field [ CURL Test::Output; $output ]
                                                                      • Set Field [ CURL Test::debug; $debug ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • If [ $result = "OK" and $httpResponse = 200 ]
                                                                      • Set Variable [ $ETag; Value:MBS("Text.FindBetween"; $headers; "ETag: \""; "\"") ]
                                                                      • Set Variable [ $XML; Value:MBS( "XML.SetPathValue"; $XML; "CompleteMultipartUpload.Part[" & $index & "].ETag"; 0; $ETag) ]
                                                                      • Set Variable [ $XML; Value:MBS( "XML.SetPathValue"; $XML; "CompleteMultipartUpload.Part[" & $index & "].PartNumber"; 0; $partNumber) ]
                                                                      • Set Variable [ $index; Value:$index + 1 ]
                                                                      • Set Variable [ $r; Value:MBS( "ProgressDialog.SetProgress"; $Offset * 100 / $FileSize ) ]
                                                                      • Set Variable [ $r; Value:MBS( "ProgressDialog.SetBottomText"; "Uploading " & $Offset & " of " & $FileSize & " Bytes.") ]
                                                                      • #pause for dialog to update
                                                                      • Pause/Resume Script [ Duration (seconds): ,1 ]
                                                                      • #Check for cancel
                                                                      • If [ MBS("ProgressDialog.GetCancel") ]
                                                                      • Set Variable [ $cancel; Value:1 ]
                                                                      • Exit Loop If [ 1 ]
                                                                      • End If
                                                                      • Set Variable [ $Offset; Value:$Offset + $BlockSize ]
                                                                      • Exit Loop If [ $Offset > $FileSize ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • End If
                                                                      • End Loop
                                                                      • #finish upload
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.SetTopText"; "Cleanup...") ]
                                                                      • If [ $Cancel ]
                                                                      • Set Variable [ $Query; Value:"uploadId=" & $UploadId ]
                                                                      • Set Variable [ $Headers; Value:"" ]
                                                                      • Set Variable [ $HashedPayload; Value:"" ]
                                                                      • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetDebugWithData"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; "DELETE"; $HashedPayload; $Headers; $Query) ]
                                                                      • If [ MBS("IsError") ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                      • Exit Script [ ]
                                                                      • Else
                                                                      • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                      • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                                      • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                                      • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                                      • Set Field [ CURL Test::Result; $result ]
                                                                      • Set Field [ CURL Test::Output; $output ]
                                                                      • Set Field [ CURL Test::debug; $debug ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • If [ $result = "OK" and ($httpResponse ≥ 200 and $httpResponse < 299) ]
                                                                      • #done
                                                                      • Show Custom Dialog [ Title: "Upload CANCELLED"; Message: $output; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • End If
                                                                      • Else
                                                                      • Set Variable [ $Query; Value:"uploadId=" & $UploadId ]
                                                                      • Set Variable [ $Headers; Value:"Content-Type: application/xml" ]
                                                                      • Set Variable [ $HashedPayload; Value:"" ]
                                                                      • Set Variable [ $curl; Value:MBS("CURL.New") ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionFollowLocation"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionMaxRedirs"; $curl; 3 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionPost"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetDebugWithData"; $curl; 1 ) ]
                                                                      • Set Variable [ $r; Value:MBS( "CURL.SetOptionPostFields"; $curl; $XML; "UTF-8" ) ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.SetupAWS"; $curl; $AWSAccessKeyId; $AWSSecretAccessKey; $Region; $Service; $Path; $Domain; "POST"; $HashedPayload; $Headers; $Query) ]
                                                                      • If [ MBS("IsError") ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with SetupAWS"; Message: $r; Default Button: “OK”, Commit: “Yes”; Button 2: “Abbrechen”, Commit: “No” ]
                                                                      • Exit Script [ ]
                                                                      • Else
                                                                      • Set Variable [ $result; Value:MBS("CURL.Perform"; $curl) ]
                                                                      • Set Variable [ $output; Value:MBS("CURL.GetResultAsText"; $curl; "UTF8") ]
                                                                      • Set Variable [ $debug; Value:MBS("CURL.GetDebugAsText"; $curl) ]
                                                                      • Set Variable [ $httpResponse; Value:MBS( "CURL.GetResponseCode"; $curl ) ]
                                                                      • Set Field [ CURL Test::Result; $result ]
                                                                      • Set Field [ CURL Test::Output; $output ]
                                                                      • Set Field [ CURL Test::debug; $debug ]
                                                                      • Set Variable [ $r; Value:MBS("CURL.Cleanup"; $curl) ]
                                                                      • If [ $result = "OK" and ($httpResponse ≥ 200 and $httpResponse < 299) ]
                                                                      • #done
                                                                      • Set Field [ CURL Test::URL; $URL ]
                                                                      • Show Custom Dialog [ Title: "Upload done"; Message: "Success!"; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Else
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      • Show Custom Dialog [ Title: "Error with Upload"; Message: $result & ¶ & ¶ & $httpResponse; Default Button: “OK”, Commit: “Yes” ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • End If
                                                                      • End If
                                                                      • Set Variable [ $r; Value:MBS("ProgressDialog.Hide") ]
                                                                      Fields used in this script
                                                                      Scripts used in this script
                                                                        Layouts used in this script
                                                                          Tables used in this script
                                                                          Table occurrences used by this script
                                                                          Custom Functions used by this script
                                                                            Custom menu set used by this script

                                                                              Previous Script: [Upload Big File]Next Script: [Import File]
                                                                              Script NameSelect File
                                                                              Run script with full access privilegesOff
                                                                              Include In MenuYes
                                                                              Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                Fields used in this script
                                                                                Scripts used in this script
                                                                                  Layouts used in this script
                                                                                    Tables used in this script
                                                                                    Table occurrences used by this script
                                                                                    Custom Functions used by this script
                                                                                      Custom menu set used by this script

                                                                                        Previous Script: [Select File]Next Script: [Clear]
                                                                                        Script NameImport File
                                                                                        Run script with full access privilegesOff
                                                                                        Include In MenuYes
                                                                                        Layouts that use this script
                                                                                        Scripts that use this script
                                                                                          Script Definition
                                                                                          Script Steps
                                                                                          • Insert File [ CURL Test::Image ] [ Storage method: Let user choose ] [ Display content ] [ Compression: Never compress ]
                                                                                          Fields used in this script
                                                                                          Scripts used in this script
                                                                                            Layouts used in this script
                                                                                              Tables used in this script
                                                                                              Table occurrences used by this script
                                                                                              Custom Functions used by this script
                                                                                                Custom menu set used by this script

                                                                                                  Previous Script: [Import File]
                                                                                                  Script NameClear
                                                                                                  Run script with full access privilegesOff
                                                                                                  Include In MenuYes
                                                                                                  Layouts that use this script
                                                                                                    Scripts that use this script
                                                                                                      Script Definition
                                                                                                      Script Steps
                                                                                                      • Set Field [ CURL Test::Access Key ID; "" ]
                                                                                                      • Set Field [ CURL Test::Access Key Secret; "" ]
                                                                                                      • Set Field [ CURL Test::Bucketname; "" ]
                                                                                                      • Set Field [ CURL Test::Region; "" ]
                                                                                                      • Set Field [ CURL Test::URL; "" ]
                                                                                                      • Set Field [ CURL Test::debug; "" ]
                                                                                                      • Set Field [ CURL Test::header; "" ]
                                                                                                      • Set Field [ CURL Test::Image; "" ]
                                                                                                      • Set Field [ CURL Test::Result; "" ]
                                                                                                      • Set Field [ CURL Test::FilePath; "" ]
                                                                                                      Fields used in this script
                                                                                                      Scripts used in this script
                                                                                                        Layouts used in this script
                                                                                                          Tables used in this script
                                                                                                          Table occurrences used by this script
                                                                                                          Custom Functions used by this script
                                                                                                            Custom menu set used by this script

                                                                                                              Download example: Amazon S3 Upload File

                                                                                                              Used functions:




                                                                                                              Links
                                                                                                              MBS Xojo Chart Plugins