Skip to main content
Inspiring
January 4, 2008
Answered

file.ServerFileExt Error

  • January 4, 2008
  • 2 replies
  • 1026 views
On the attached code, I am getting an error message telling me file.ServerFileExt is not defined. I can't see anything wrong with the attached code, but then I've been looking at it too long. Any ideas on what could be wrong?

Thanks,
Gwen H
    This topic has been closed for replies.
    Correct answer JR__Bob__Dobbs-qSBHQ2
    See attached sample with notes.

    2 replies

    Inspiring
    January 4, 2008
    Additional note.

    I'm sure about the behavior of cffile tag and cffile variables, but it is possible that the second use of <cffile> for the rename resets the values of the cffile variable.

    You might try

    <cffile action="upload" etc.... />

    <cfset variables.myFileExtesion=cffile.ServerFileExt />

    <cffile action="rename" destination="C:\mypath\#form.lname#-#form.fname#-#form.zip#.#variables.myFileExtesion#" etc... />
    GwenHAuthor
    Inspiring
    January 4, 2008
    Still checking your previous answer. So far the code does not work; I think it might be an issue of write permissions on the server. I had write permission issues earlier in the week with another website running PHP. The hosting company is looking into it.

    In the meantime, is there a way in CF to do this? (Pseudocode below)

    <cfset fileExt = extension of file selected in file input field on form (named "attachment" in this project)>
    or
    <cfset fileExt = form.attachmentExttensions>

    ?????

    Many thanks,
    Gwen H
    JR__Bob__Dobbs-qSBHQ2Correct answer
    Inspiring
    January 4, 2008
    See attached sample with notes.