CHTTP "PUT" method for Rackspace

Has anyone seen this issue in Lucee ( version 5.3.1.102 – Gelert ) when attempting to upload images to a Rackspace File container. The file gets uploaded but the file is corrupt with what appears to be a headers at the start of the file. I’m not able to reproduce the issue on Adobe ColdFusion version 11.

CFHTTP call being made:

<cfhttp method="PUT" url="#rackSpaceURL#/#rackSpaceContainer#/#imageFolder#/#fileToUpload#" result="local.response">
    <cfhttpparam type="header" name="X-Auth-Token" value="#local.token#">
    <cfhttpparam type="header" name="Content-type" value="#local.typeOfFile#">
    <cfhttpparam type="file" name="myphoto" file="#fileToUpload#">
</cfhttp>

Looking at the file contents that get uploaded ( via vim ):

–5lr38ly0cCdbFdaUyPsK5JOlIB-Vjr^M
Content-Disposition: form-data; name=“myphoto”; filename=“EBF023A6-CCD1-4782-BEB312564F1A5A06_main-image.jpg”^M
Content-Type: image/jpeg^M
Content-Transfer-Encoding: binary^M
^M
ÿØÿà^@^PJFIF


The last line is the beginning of the jpeg image file.

If I’m missing something obvious or if there are additional troubleshooting steps I should try, please let me know.

Regards,
~G

Have you found a solution for this? We have the same issue.

Use Cloudfuse to mount the volume then manipulate the files as local files.

@Terry_Whitney, thank you for the suggestion. I failed to mention we are running on a Windows Server host and this doesn’t look like it will work for us. The underlying solution appears to use CURL so we may have to use a port of CURL to workaround the issue.

Thanks.

You could use cygwin to build from source cloudfuse or you would WSL to install your favorite distro then its just a matter of running the correct path and making sure your server version supports WSL.

try cfhttp multipart=true

A solution has been found that I’ve verified works (sending the file as binary in the body instead of as a file type):

<cfhttp method="PUT" url="#variables.publicEndPoint#/#variables.containerName#/#variables.cdnPath#/#local.fileName#" result="local.response">
                <cfhttpparam type="header" name="X-Auth-Token" value="#variables.token#">
                <cfhttpparam type="header" name="Content-type" value="#local.typeOfFile#">
                 <cfhttpparam type="body"  value="#fileReadBinary(expandpath(variables.filePath))#" mimetype="#local.typeOfFile#">
</cfhttp>

~G