Question: 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>

```

Answer: 
The reason that your dump is not happening is because `<input type="button">` does not submit forms unless you are doing that via JavaScript.

Please read [Difference between <input type='button' /> and <input type='submit' />](https://stackoverflow.com/questions/290215/difference-between-input-type-button-and-input-type-submit)
You can try the below code. This dumps the value of the path as well.

```
<cfif isDefined('Form.tmpfile1')>
    <cfset root = ExpandPath("/Upload")><!---location where file should be uploaded--->
    <cfset filename=GetFileFromPath(Form.tmpFile1)>
    <cfset FileExt=ListLast(filename,".")>
    <cfset variables.filepath ="">      
    <cfset filename = "BidDocument1." & FileExt>

    <cffile action="upload" 
            filefield="BidDoc1" 
            destination="C:\Upload\" 
            nameconflict="overwrite" 
            accept="application/pdf,application/msword,application/vnd.ms-excel,text/plain,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet">
    <cfset variables.filepath= "C:\test\#cffile.serverFile#">
    <cfdump var="#variables.filepath#">
</cfif>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>cffileupload Document</title>
        <form name="form1" enctype="multipart/form-data" method="post">
            <input type="hidden" name="tmpfile1" value="" />
            <input  type="file"  name="BidDoc1"  onchange="setFile(this.form);" />
            <input type="submit" name="save1" value="Upload" />  
        </form>
        <button onclick="location.href='processfile.cfm'">Process</button>
</html> 

```

This should help you.