在回发时保留ColdFusion中type ="file"的输入值

jbr*_*112 2 coldfusion

我在ColdFusion中有一个表单,最初有5个输入字段用于文件上传.如果用户意识到他们在附加过程中要上传的文件超过5个,我希望表单在为#of字段的更改提交自身时保留这些值.

使用<cfform>带有preserveata ="yes"属性的标签应该可以实现这一点 - 但我得到的只是在重新提交时存储在输入值中的临时值,该值不会显示在字段中,也不适用于提交.

编辑: 感谢大家的精彩回答,你们都帮助并且是正确的.我能够实现Adam的建议解决方案.效果很好!谢谢!

function changeFieldCount()  // javascript function for submit on input count change
 {
  var count = document.forms[0].numtotal.options[document.forms[0].numtotal.selectedIndex].value;
   document.forms[0].action = "me.cfm?count=" + count;
   document.forms[0].submit();
 }
Run Code Online (Sandbox Code Playgroud)
<cfparam name="url.count" default="5">

<cfform name="dispfiles" method="post" enctype="multipart/form-data" preservedata="yes">
  <!--- looping for file input fields --->
  <cfloop index="counter" from="1" to="#url.count#">
    <cfinput type="file" name="file#counter#" size="50" maxlength="60"><br>
  </cfloop>

  <br>Number of Files to Attach: 
  <!--- looping for # of input selection--->
  <cfselect name="numtotal">
    <cfloop index="cnt" from="1" to="20" step="1">
        <cfoutput>
        <option value="#cnt#" <cfif #cnt# eq #url.count#>selected</cfif>>
            #cnt#
        </option>
        </cfoutput>
    </cfloop>
  </cfselect>

   <cfinput type="button" name="op-display" value="Display" onclick="changeFieldCount()">
   <cfinput type="button" name="op-upload" value="Attach Files" onclick="submitfrm(this.form)">
   <cfinput type="button" name="cancel" value="  Cancel  " onclick="window.close()">
</cfform>
Run Code Online (Sandbox Code Playgroud)

当我在结果提交中查看源代码时,这就是我所得到的:

<input name="file1" id="file1"  type="file" value=".../cfusion.war/neotmp8858718543274653167.tmp" maxlength="60"  size="50"  /><br>
Run Code Online (Sandbox Code Playgroud)

rip*_*747 5

出于安全原因,这是在所有浏览器中设计的.您无法插入文件字段的值.