CFFILE tag reference to MS Excel is invalid.

Posted on 2006-04-18
Last Modified: 2013-12-24
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?

Code below:

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

      <cfquery name="getExcel" datasource="ExcelData">
            SELECT col1,
            FROM [sheet1$]
            in 'D:\Coldfusionsites\x.x\databases\cor.xls'"Excel 8.0;IMEX=1;"
      <CFLOOP query="getExcel">
            <cfquery name="addrecords" datasource="#application.dsn#">
                  INSERT INTO tablename
Question by:dkbailey1
    LVL 10

    Expert Comment


    i imagine the destination directory isnt valid on your new server.
    LVL 18

    Accepted Solution


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


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


    Author Comment

    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;"

    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    Suggested Solutions

    Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…
    Meet the world's only “Transparent Cloud™” from Superb Internet Corporation. Now, you can experience firsthand a cloud platform that consistently outperforms Amazon Web Services (AWS), IBM’s Softlayer, and Microsoft’s Azure when it comes to CPU and …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now