Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1095587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:08:58+00:00 2026-05-17T00:08:58+00:00

Update : I’ve found a workaround. If I submit a dummy form field along

  • 0

Update: I’ve found a workaround. If I submit a dummy form field along with the file, it works. Is this a ColdFusion bug, or is there something in the HTTP spec that says forms must contain at least one non-file form field?

Update 2: I’m convinced this is a ColdFusion cfhttp bug. This is based on Leigh’s answer and the fact that I used the code below to submit a form with only the file element using javascript, and it works fine:

<form enctype="multipart/form-data" action="<cfoutput>#CGI.PATH_INFO#</cfoutput>" method="POST" name="theForm">
  <input name="theFile" type="file" /><br/>
</form>
<a href="#" onclick="document.theForm.submit()">submit</a>

I’m running into a problem uploading files from a ColdFusion server to another webserver. It seems that cfhttpparam type="file" is indiscriminately appending a newline (carriage return and line feed) to the end of the file. This is breaking binary files. This does not happen when I manually upload the file via form field. I have tried with and without mimetype parameter, and I’ve tried lying about mimetype with various binary formats (exe, zip, jpg), but nothing has worked. Is there some parameter I’m missing, or is this a bug in ColdFusion? (I’m running on CF 8.0.1.195765 on WinXP.)

Below is test code I’m using, it just uploads the file to the same directory. The manual upload works, but the server-based upload ends up appending a CRLF to the file.

<cfset MyDir = "C:\test" />
<cfset MyFile = "test.zip" />

<cfif IsDefined("Form.TheFile")>
  <cffile action="upload" fileField="theFile" destination="#MyDir#" nameConflict="MakeUnique" />
<cfelse>
  <cfhttp url="http://#CGI.SERVER_NAME##CGI.SCRIPT_NAME#" method="POST" throwOnError="Yes">
    <cfhttpparam type="file" name="theFile" file="#MyDir#\#MyFile#" />
  </cfhttp>
</cfif>

<html><body>
<h2>Manual upload</h2>
<form enctype="multipart/form-data" action="<cfoutput>#CGI.PATH_INFO#</cfoutput>" method="POST">
  <input name="theFile" type="file" /><br/>
  <input type="submit" value="Submit" />
</form>
</body></html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:08:59+00:00Added an answer on May 17, 2026 at 12:08 am

    or is there something in the HTTP spec
    that says forms must contain at least
    one non-file form field?

    I do not know for certain. But according to these definitions it seems like a POST containing only a file input should be valid. So I suspect the problem may be CFHTTP in ACF.

    According to Fiddler the raw content from the cfhttp call in ACF contains an extra new line just before the end boundary (0D 0A in hex view). But under Railo it does not. So I think ACF’s cfhttp might be the culprit.

    Sample Code:

    <cfhttp url="http://127.0.0.1:8888/cfusion/receive.cfm" method="post">
        <cfhttpparam name="myFile" type="file" file="c:/test/testFile.zip" mimetype="application/octet-stream" />
    </cfhttp>
    

    Results Railo 3.1.2

    POST /railo/receive.cfm HTTP/1.1
    User-Agent: Railo (CFML Engine)
    Host: 127.0.0.1:8888
    Content-Length: 382
    Content-Type: multipart/form-data; boundary=m_l7PD5xIydR_hQpo8fDxL0Hb7vu_F8DSzwn
    
    --m_l7PD5xIydR_hQpo8fDxL0Hb7vu_F8DSzwn
    Content-Disposition: form-data; name="myFile"; filename="testFile.zip"
    Content-Type: application/octet-stream; charset=ISO-8859-1
    Content-Transfer-Encoding: binary
    
    PK
    &�1=�cN'testFile.txtTestingPK
    &�1=�cN' testFile.txtPK:1
    --m_l7PD5xIydR_hQpo8fDxL0Hb7vu_F8DSzwn--
    

    Results ACF (versions 8 and 9)

    POST /cfusion/receive.cfm HTTP/1.1
    Host: 127.0.0.1:8888
    ... other headers removed for brevity ....
    Content-type: multipart/form-data; boundary=-----------------------------7d0d117230764
    Content-length: 350
    
    -------------------------------7d0d117230764
    Content-Disposition: form-data; name="JobFile"; filename="c:\test\testFile.zip"
    Content-Type: application/octet-stream
    
    PK
    &�1=�cN'testFile.txtTestingPK
    &�1=�cN' testFile.txtPK:1
    
    -------------------------------7d0d117230764--
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.