I have 2 submit buttons in a form. I will upload a file and save in a filepath in server when I click on one "upload" button. I want to use this file path in the code when I click on another button called "Process". When I click the process nothing is happening with dump in below code. Form submits to itself. Is there any better way to do this. Thanks in advance.
<table width="40%" border="0" style="border: 1px solid black;">
<form name="uploadform" action="processfile.cfm" enctype="multipart/form-data"
method="post">
<tr>
<td><input type="file" name="FileContents" size="25">
<input type="button" name="action" id="action" value="Upload">
</td>
</tr>
<tr>
<td align="middle">
<input type="button" name="submitaction" id="process" value="Process">
</td>
</tr>
</form>
</table>
<!---Clicking the fist button to upload--->
<cfset variables.filepath ="">
<cfif isdefined("form.action") AND form.action eq "upload">
<cffile action = "upload" fileField = "FileContents" destination = "C:\test\" accept = "text/plain" nameConflict="overwrite">
<cfset variables.filepath= "C:\test\#cffile.serverFile#">
<!---Clicking the second button to process--->
<cfelseif isdefined("form.submitaction") AND form.submitaction eq "process">
<cfdump var="#variables.filepath#">
</cfif>