Skip to main content
July 25, 2009
Question

FORM.screenshot is Undefined

  • July 25, 2009
  • 3 replies
  • 804 views

Hi. I am trying to upload a file from a form. In my CFFORM, i have the following input:

<cfinput type="file" name="screenshot" width="250" value="" />

The page I submit to has this line at the top:

<cfif FORM.screenshot NEQ "">

       <!--- first actually upload the file --->

       <cffile action="upload"

                 filefield="screenshot"

                 destination="D:\temp\"

                 nameconflict="makeunique">

        <!--- now create a temporary holder for the attachment later on --->

        <cfset screenshot_local_file = "D:\temp\#file.serverfile#">

</cfif>

However, when I upload the page, I get FORM.screenshot is undefined. All other form fields work fine.

Thanks for the help. 🙂

    This topic has been closed for replies.

    3 replies

    July 25, 2009

    Actually, I fixed it. I did some more Googling, and added

    enctype="multipart/form-data"

    to my cfform tag and it worked. Thanks anyways for the help!

    July 25, 2009

    Actually, I fixed it. I did some more Googling, and added

    enctype="multipart/form-data"

    to my cfform tag and it worked. Thanks anyways for the help!

    Dileep_NR
    Inspiring
    July 25, 2009

    hi

    try this

    <cfif isdefined('form.screenshot') AND form.screenshot  NEQ "">

    ....

    ......

    </cfif>

    July 25, 2009

    Thanks, I tried, but all I get is an email without the file I selected in the form... as if FORM.screenshot is still undefined.