Uploading text files to S3 using API

Hey,
I can find a few examples on Github etc for uploading mp3 and jpeg files but can anyone point me in the right direction for uploading text files (preferably using an API) to S3?
Thanks