7 Replies Latest reply on May 23, 2017 9:57 PM by BKBK

    ColdFusion CFHTTPPARAM Content-Type?


      I am attempting to upload a file using the Dropbox API.  Dropbox requires Contact-Type = "application/octet-stream", which I am tried to set in the cfhttpparam type = "header".  However when I post the data to the API.  I get an error stating: Bad HTTP "Content-Type" header: "application/octet-stream,multipart/form-data; boundary=-----------------------------7d0d117230764".  I am guessing that when a cfhttpparam type = "file" is included, the content-type is modified to also include multipart/form-data.  The api will not accept this content-type.  Is there a way to avoid this behavior?  This is the code I am using to attempt the upload.  Thank you.


      <cfhttp method="post" url="https://content.dropboxapi.com/2/files/upload" result="uploadFile">

        <cfhttpparam type="header" name="Authorization" value="Bearer #DropboxAccessToken#">

        <cfhttpparam type="header" name="Dropbox-API-Arg" value="#serializeJSON(stFields)#">

        <cfhttpparam type="header" name="Dropbox-API-Select-User" value="#DropboxMemberID#">

        <cfhttpparam type="header" name="Content-Type" value="application/octet-stream">

        <cfhttpparam type="file" name="1_1036.gif" file="C:\1_1036.gif">