Binary Upload

So I’m having an issue with an api that requires files uploaded in binary form. I thought I had it figured out but am still getting errors when trying it.

So the way it works is we send a request to the api, and they return us a pre-signed, AWS S3 Bucket url, which we then upload the file to, and it’s the upload process that’s giving me trouble now.

Their documentation shows this as an example for uploading the file

curl --location --request PUT '{base_s3_url}/{auto-generated string}' \
--header 'Content-Type: text/plain' \
--data-binary '@/Users/folder/Downloads/test.pdf'

Regarding the content-type, I checked with one of their support guys and he said it had to be text/plain no matter what type of file you were uploading.

I’ve tried the following two options, and in both cases it’s giving me an error.

<cfhttp url="#bucketurl#" timeout="10" method="put">
	<cfhttpparam type="header" name="content-type" value="text/plain">
	<cfhttpparam type="file" name="" file="#FileName#">
</cfhttp> 
	
<cfhttp url="#bucketurl#" timeout="10" method="put">
	<cfhttpparam type="header" name="content-type" value="text/plain">
	<cfhttpparam type="body" value="#fileReadBinary(FileName)#"> 
</cfhttp>

Now the error message I’m getting is SignatureDoesNotMatch, so I think there may be an additional issue with the bucket url, but before I go back to them, I wanted to verify what the correct method is for replicating --data-binary with cfhttp.

EDIT: Just wanted to note the error I’m getting is from the S3 Bucket when I attempt the http request, not from Lucee.

Thanks!

did you try the mimetype attribute with type=“file” ?