cffile

Discussion in 'Programming' started by Jamie18, Sep 6, 2007.

  1. #1
    hey, i'm having a problem with uploading excel files in IE..

    i'm not sure where the problem is but i think it's in the <cffile> tag


    here's the server side part of things... the numbers etc are just for debugging purposes..
    
    <cfif isdefined("submitfile")>
        <cfset filepath="somepath">
    
        <cftry>
            <!--- Get the file from the client, save it to temp directory --->
            1.
            <cfdump var="#Form.fileinput#">
            <cffile action="upload"
                destination="#filepath#"
                nameConflict="overwrite"
                fileField="Form.fileinput"
                accept="application/msexcel">
            2. 
            <cfdump var="#Form.fileinput#">
            <cfset filename="#cffile.ClientFileName#.#cffile.ClientFileExt#">
        
            <!--- extract data from excel sheet --->
            <cfx_excel action="read"
                file="#filepath##filename#"
                result="resultset"
                formula="show">
            3.
            <cfdump var="#resultset#">
            
            <cfoutput query="resultset">
                <cfquery datasource="pad" name="updatequery">
                    UPDATE    Phone
                    SET        WPS_Kickout_Reason = '#B#'
                    WHERE    Phone = #A#
                            AND WPS = 1
                </cfquery>
            </cfoutput>
            4.
            
            <cfoutput>
                <p>#filename# has been uploaded successfully.</p>
            </cfoutput>
        
        <cfcatch type="Any">
            <!--- Either the file uploaded wasn't an excel spreadsheet or column A is not numeric --->
            <p>ERROR: You Must upload a valid Excel file(.xls). (Column A as phone numbers, Column B as kickout reasons)</p>
        </cfcatch>
        
        </cftry>
    
    Code (markup):
    and the average html file input
    
    <input type="File" id="fileinput" name="fileinput">
    
    Code (markup):
    this works perfectly fine in firefox but not in IE6..

    i'm thinking maybe it has something to do with the accept="application/msexcel"?

    the output stops after the fileinput dump.. so the problem must be in the cffile

    thanks for any help

    ps cfx_excel is a custom tag
     
    Jamie18, Sep 6, 2007 IP
  2. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    pps. the filepath variable is a real path, not simply 'somepath'
     
    Jamie18, Sep 6, 2007 IP
  3. Jamie18

    Jamie18 Peon

    Messages:
    201
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    accept="application/msexcel, application/vnd.ms-excel" did the trick
     
    Jamie18, Sep 7, 2007 IP