FileRead and GoogleBucket

I’mplay with Google Bucket API.

Try this:

cfhttp( url="#myUrl#/mybucket/o?uploadType=media&name=#name#" 
    ) {
    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

try fileReadBinary()

Same :frowning:

did you try type="file" with cfhttpparam?

thanks Zac!
with “type=file” is better.
but so GoogleCloud dont set the Content-Type.
It’s like Lucee doesn’t send “Content-Type” headers with “type=file”

It’s possible?

docs say use mimetype?