Skip to main content
Inspiring
May 15, 2012
Question

CFFile action blues

  • May 15, 2012
  • 1 reply
  • 1210 views

I am trying to let a user upload excel spreadsheets to a different directory that is located on our webserver.

I have tried many paths but it always comes back withe same error.     pls see cod

<form action="upLoadFileAction2.cfm"

        enctype="multipart/form-data"

        method="post">

    <p>Enter the complete path and filename of the file to upload:

    <input type="file"

            name="datafile"

            size="125">

    </p>

    <input     type="submit"

            value="Upload">

</form>

---------------------------------------------------------------------------------------------------------------------------------------------

         <cffile action="upload"
        destination="S:\LibraryData\FORMS\PROSPECTUS_and_WORKSHEET\NEWkshts/"
        nameConflict="overwrite"
        fileField="dataFifle" >
            
<cfoutput>
You uploaded #cffile.ClientFileName#.#cffile.ClientFileExt#
            successfully to #cffile.ServerDirectory#.
</cfoutput>

This topic has been closed for replies.

1 reply

Inspiring
May 15, 2012

You didn't tell us the error, but it might have something to do with the forward slash at the end of your destination.

rockhikerAuthor
Inspiring
May 15, 2012

I changed the forward slash but I am still getting: The form field dataFifle did not contain a file error as seen below.

The form field dataFifle did not contain a file.

The error occurred in C:/Webroot/Crabweb1a/Administration/FormsAdmin/upLoadFileAction2.cfm: line 13

11 :         destination="S:\LibraryData\FORMS\PROSPECTUS_and_WORKSHEET\NEWkshts\"
12 :         nameConflict="overwrite"
13 :         fileField="dataFifle"
Legend
May 16, 2012

Did you check the spelling of your form field name carefully? I see dataFile and dataFifle.

Make sure your application.cfm or application.cfc file does not manipulate form.dataFile. I had some logic that trimmed the contents and did some xss filtering -- cffile=upload didn't like that.