Aws s3 pre signed url upload

Did anyone succeed in uploading to aws S3 using the file transfer plugin and pre signed url ?

In my case, I succeed in uploading a file but the file in aws seems unreadable.
Here is an example.

I’ve integrated Amazon S3 successfully but I didn’t use the presigned URLs. I just use a base64-encoded/signed policy and API key.

To do this securely you would have to put the key and the policy on a server (building a simple REST API using nodejs/expressjs), but this applies to pre-signed URLs as well - you need a server to generate them securely.

So in the end I didn’t see the advantage of the pre-signed URLs over the conventional approach.

I want the files to be uploaded from the ionic app, but the names of the files are generated from the server.

I don’t think this is possible with bucket policy, is it ?

It is, if the bucket policy is generated on the server.

I don’t really see the advantage of the pre-generated URLs over bucket policies.

Thank you for your advice
For the moment, all i need is something that works. And replacing the ngcordova plugin with the original one made it work perfectly

1 Like

I am trying to implement a video upload to S3. I am a bit confused with what is being discussed here. What are the differences between your two approaches? I understand S3 allows to upload files directly to a bucket without needing to pass it to the server. Is this implemented in both cases? Can anyone share or point me to code that does this? Thanks

in my case, i used the pre signed url
you still need a server to generate a signed url using the aws sdk
then, the ionic app sends the file to that signed url using cordova file transfer plugin

i don’t know how the method suggested by leob works

I also had the issue that the uploaded file couldn’t be opened properly. Using the cordova file-transfer, adding my aws key, policy, and signature to the option params solved it.