Upload file to S3 via AWS API gateway

I am working on task where trying to upload media file to AWS S3 via AWS API gateways.
For that i am using ignition provided system.net.httpPut() method.

filedata = event.file.getBytes()
response = system.net.httpPut(url, putData =filedata)
url variable having bucket & filename as queryParameter
this works for .jsp file but doesnt work for other media file.

Have anyone tried successful upload and download of files? if yes , please give suggestions/guidance

If it works for one filetype but not others, it might be due to a content type mismatch?
I would recommend migrating to system.net.httpClient, which will be more performant and give you more useful error conditions back.