• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 465
  • Last Modified:

CFFILE tag reference to MS Excel is invalid.

I have recently taken over support for a ColdFusion website, and have migrated the site to a new server.  There are some webpages that allow the user to upload an MS Excel file using CFFILE tag,  in conjunction with CFLOOP and INSERT statements.  This MS Excel upload process now fails on the CFFILE tag.  The error message is:

"The destination "D:\Coldfusionsites\x.x\databases" specified in the CFFILE tag is invalid."

Can someone explain what CFFILE is trying to do, and I need to do to fix this?

Thanks,
Code below:

<cffile action="upload" filefield="fileupload" destination="D:\Coldfusionsites\x.x\databases" nameconflict="overwrite">

      <cfquery name="getExcel" datasource="ExcelData">
            SELECT col1,
                                            col2
            FROM [sheet1$]
            in 'D:\Coldfusionsites\x.x\databases\cor.xls'"Excel 8.0;IMEX=1;"
      </cfquery>
      
      <CFLOOP query="getExcel">
            <cfquery name="addrecords" datasource="#application.dsn#">
                  INSERT INTO tablename
                        (
                              col1,
                              col2
                        )
                  VALUES
                        (
                                                  '#GETEXCEL.value1#',
                                                  '#GETEXCEL.value2#'
                                                    )
              </CFQUERY>
      </CFLOOP>
      
0
dkbailey1
Asked:
dkbailey1
1 Solution
 
rob_lorentzCommented:

i imagine the destination directory isnt valid on your new server.
0
 
PluckaCommented:
dkbailey1,

The CFFILE tag is taking the file from the upload form and saving it to the server in the directory.

D:\Coldfusionsites\x.x\databases

This error suggests that this directory does not exist. If you create it, it will most likely fix your problem.

Regards
Plucka
0
 
dkbailey1Author Commented:
I now have the CFFILE tag working, but my SELECT statement does not recognize the path.  The path worked for CFFILE though.  Maybe it has something to do with the Excel and IMEX references at the end of the 'in' statement.

Any thoughts?  Thanks.

<cffile action="upload" filefield="fileupload"       destination="\\xxxx\yyy\process" nameconflict="overwrite">


<cfquery name="getExcel" datasource="ExcelData">
           SELECT       col1
           FROM [sheet1$]
           in '\\xxxx\yyy\COR.xls'"Excel 8.0;IMEX=1;"
</cfquery>
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now