Skip to main content
Participant
September 8, 2010
Answered

File upload error - did not contain file

  • September 8, 2010
  • 1 reply
  • 3221 views

I get the the error below on uploading a file.

The form field "C:\CFusionMX7\runtime\servers\coldfusion\SERVER-INF\temp\wwwroot-tmp\neotmp3266.tmp" did not contain a file.

Find below source code

-- environment details

CF7

-- upload form

<form action="doUpload.cfm" method="post" id="frmUpload" name="frmUpload" enctype="multipart/form-data">
<table width="100%" cellspacing="0" cellpadding="0">
    <tr>
        <td class="normaltxt" colspan="2"> CSV File Path:</td>
    </tr>
    <tr>
        <td align="left"><input type="file" name="sFilePath" id="sFilePath" accept="csv" size="20"/></td>
        <td><input type="submit" value="upload"></td>
    </tr>
    <tr><td id="uploaderror" colspan="2"> </td></tr>
</table>
</form>   
</table>

--doUpload.cfm

<cffile action="upload" filefield="#form.sFilePath#" destination="C:\" nameconflict="overwrite" result="upload">

Does anyone know why.

    This topic has been closed for replies.
    Correct answer JR__Bob__Dobbs

    The filefield value should be a string, not a variable. Try changing the filefield attribute of CFFILE to filefield="sFilePath".

    http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000253.htm#3540091

    You should also verify that the CF service has sufficient rights to create files in your destination directory.

    1 reply

    JR__Bob__DobbsCorrect answer
    Inspiring
    September 8, 2010

    The filefield value should be a string, not a variable. Try changing the filefield attribute of CFFILE to filefield="sFilePath".

    http://livedocs.adobe.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&file=00000253.htm#3540091

    You should also verify that the CF service has sufficient rights to create files in your destination directory.