Quantcast
Channel: Adobe Community : Unanswered Discussions - ColdFusion
Viewing all articles
Browse latest Browse all 5794

working with 2 submit buttons in a html form

$
0
0

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>

<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#">

 

<cfelseif isdefined("form.submitaction") AND form.submitaction eq "process">

          <cfdump var="#variables.filepath#">

</cfif>


Viewing all articles
Browse latest Browse all 5794

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>