Send client file from browser to external API
Question

I am searching for a way in my traditional web app to allow a client to select a local file from their computer and upload it directly to an external API (in this case, AWS with a pre-signed url). 

I don't want to upload the file to OS server and then send to AWS as that seems like an extra hop that is un-necessary and the files are videos that are from 5 to 7 gig each.

Is there a client action I can use to send the file directly to AWS without performing an upload first?


Thank you

Hi,

Does this thread help in your situation? It appears that if you have the necessary permissions to the S3 buckets, then you could leverage the following forge components to upload files.

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

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

I have not used the components, so I am not quite sure if the file sizes you are dealing will pose a problem or not.

Regards,

AJ

Thank you for the response but I am not connecting to S3 directly so the forge component does not help. I am simply trying to send a file to a restful API from the client browser instead of a server action.

You should be able to do it using client side javascript. maybe something like the below


jquery - File upload using ajax and rest web service - Stack Overflow 


Champion

I tried to send the file to the rest API.

 I exposed an API from a module with binary input and call this API and sent the file binary. I am able to get it on the API side.

Please check the attached OML. 

please correct the API URL according to your env.


Newfolder7.zip

Hi @Amit Jain,

Your method still uploads the file to OS server side first. I can produce 413 error if the file size is too big. What about the way to send large file to AWS pre-signed URL from client side browser directly?

Regards,

George 

Champion

For Long files, I will suggest splitting large files into chunks and the send them via API.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.