Copy link to clipboard
Copied
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. 🙂
Copy link to clipboard
Copied
hi
try this
<cfif isdefined('form.screenshot') AND form.screenshot NEQ "">
....
......
</cfif>
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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!
Copy link to clipboard
Copied
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!