ColdFusion Cffile上传将参数传递到动作页面

发布于 2025-01-19 20:04:40 字数 958 浏览 2 评论 0原文

在ColdFusion中,我有一个基本的CFFILE上传,当NameConflict参数明确时,例如“ oftrite”。但是,当我尝试传递参数时,它不起作用。

<cfoutput>
<cfset confl = 'overWrite'>
<form 
  enctype = "multipart/form-data" 
  method  = "post" 
  name    = "uploadForm"  
  action  = "">

   <input name  = "theupload" 
          type  = "file" 
          style = "font-family: comic sans ms; color: ##679C9C">

  <input type = 'hidden' name = 'confl' value = '#confl#'>   
  <cfinclude template = 'submitbut.cfm'>
  </form>
  </cfoutput> 

  <cfif IsDefined("form.theupload")>
  <cfoutput>
   <cffile action = "upload"
    destination   = "#session.exploc#"
    fileField     = "form.theupload"        
    mode          = '666'
    result        = 'ss'
    nameConflict  = "#form.confl#" >

   </cfoutput>
   </cfif>

这只是cffile上传的本质吗?有没有办法将参数传递到操作页面?以上代码在多个地方使用,我并不总是希望“覆盖”名称冲突。当唯一的区别在于名称冲突中,我不得不使用两个程序。

In coldfusion I have a basic cffile upload which works fine when the nameconflict parameter is explicit, such as 'overwrite'. But when I try to pass a parameter, it doesn't work.

<cfoutput>
<cfset confl = 'overWrite'>
<form 
  enctype = "multipart/form-data" 
  method  = "post" 
  name    = "uploadForm"  
  action  = "">

   <input name  = "theupload" 
          type  = "file" 
          style = "font-family: comic sans ms; color: ##679C9C">

  <input type = 'hidden' name = 'confl' value = '#confl#'>   
  <cfinclude template = 'submitbut.cfm'>
  </form>
  </cfoutput> 

  <cfif IsDefined("form.theupload")>
  <cfoutput>
   <cffile action = "upload"
    destination   = "#session.exploc#"
    fileField     = "form.theupload"        
    mode          = '666'
    result        = 'ss'
    nameConflict  = "#form.confl#" >

   </cfoutput>
   </cfif>

Is this just the nature of cffile upload? Is there a way to pass a parameter to the action page? The above code is used in several places, and I don't always want the name conflict to be 'overwrite'. I hate to have to use two programs when the only difference is in the name conflict.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱本泡沫多脆弱 2025-01-26 20:04:40
  1. &lt; cffile&gt;包装在CFC中的功能中。
  2. 使所有变量参数的所有变量参数。
  3. 创建CFC(或将其放入Application范围)。
  4. 为每个表单正确调用设置的功能。

在CFC内部,请勿参考sessionformapplicationrequest或任何其他外部示波器变量。仅将数据作为参数传递给该函数。另外,请确保varlocal范围范围所有功能特定变量。

  1. Wrap the <cffile> in a function inside a CFC.
  2. Make all of the variables arguments of the function.
  3. Create the CFC (or put it in the application scope).
  4. Call the function with the settings correct for each form.

Inside the CFC, do NOT reference session, form, application, request or any other external scoped variables. Only pass data in as arguments to the function. Also, make sure to var or local scope all function specific variables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文