How do you upload an image from base64 to AWS S3 in FileMAker

Francis:
How do you upload an image from base64 to s3 in Filemaker?


Jason Wood:

Set Variable [ $container ; Base64Decode ( $base64 ; $filename )
Set Variable [ $curl ; "-X PUT -H " & Quote ( "Content-Type: " & $contentType) & " --data-binary @$container ]
Set Variable [ $path ; "folder/thefilename.jpg" ]
Set Variable [ $url ; s3presignedUrl ( "PUT" ; $bucket ; $region ; $path ; 60 ; $access_key ; $secret_key ; "" ]
Insert From URL [ Select ; With dialog: Off ; Target: $result ; $url ; Verify SSL Certificates ; cURL options: $curl ; Do not automatically encode URL ]

Francis:
Boom!! Thanks, Jason!


For future travelers “application/octet-stream” is the contentType