Upload file to a AWS bucket with a pre signed URL

Upload file to a AWS bucket with a pre signed URL

  

Hello,


I have a web page with a file upload widget and content of the uploaded files needs to be stored in a AWS S3 bucket for which I have a pre signed URL.


I need to build something similar to this (javascript):

https://gist.github.com/guumaster/9f18204aca2bd6c71a24#file-03-upload-js


or this (python):

import os
import requests
file_size = os.path.getsize('./AUDIO-2018-06-01-13-55-33.opus')
url =  '[PRE SIGNED URL]'
headers = {
    'Content-Length': str(file_size),
}
with open('./AUDIO-2018-06-01-13-55-33.opus', 'rb') as data:
  response = requests.put(url, data=data, headers=headers)
  print(response)
  print(response.content)


I have tested to do do the upload in a js funcion without any success.



Do you have any sugestions on how to build this? 


Thank you

There are a couple components in the Forge.

Have you searched there? Maybe you can take some ideas...


https://www.outsystems.com/forge/component-discussions/3551/Amazon+S3+Connector

https://www.outsystems.com/forge/component/3546/amazon-s3/

João Heleno wrote:

There are a couple components in the Forge.

Have you searched there? Maybe you can take some ideas...


https://www.outsystems.com/forge/component-discussions/3551/Amazon+S3+Connector

https://www.outsystems.com/forge/component/3546/amazon-s3/

Thank you João.

I did look into forge components but my understanding is that to use them you need to have access to the bucket.

In my case I don't. I just have a pre signed url to put the file. This is a different URL for each file that is generated an provided to me by an external api.


As I see this it doesn't really matter that this is a S3 bucket. I need to do a put operation to a given url and send a file in the request.

Does this make sense?