I’mplay with Google Bucket API.
Try this:
cfhttp( url="#myUrl#/mybucket/o?uploadType=media&name=#name#"
method="post
result="result"
) {
cfhttpparam( type="header", name="Authorization", value="Bearer #getAccessToken()#" )
cfhttpparam( type="header", name="Content-Type", value="application/pdf OR image/jpeg" )
cfhttpparam( type="body", value=myBinaryFile );
}
If myBinaryFile is:
myBinaryFile = FileRead( 'myPdf.pdf')
works perfectly.
With image:
myBinaryFile = FileRead( 'myImage.jpg')
the file is uploaded correctly but it is corrupted.
I try with ImageRead() but i have the same result.
Any idea?
OS : Ubuntu 20.04.5 LTS
Java Version : 11.0.11 (AdoptOpenJDK) 64bit
Lucee Version : Lucee 5.3.10.133