linux - ColdFusion/Linux multipart/form-data 编码文件上传问题

标签 linux forms coldfusion enctype

我在 Linux 上的 ColdFusion 中发布了一个表单。表单有一个文件字段。 CF 需要表单标签上的 enctype="multipart/form-data"属性。如果我有这个,我会得到一个“JRun Servlet Error - 500 No such file or directory”

如果我去掉 attrib,表单就会发布,我会收到 CF“enctype=multipart/form-data”错误。

怎么办?

下面是表格的精简版:

 <form action="post.cfm" name="form2" id="port_form" method="post" enctype="multipart/form-data">
      <input type="text" id="name" name="name" value="#port_name#"><br>
      <input type="file" id="before" name="before"><br>
      <input type="hidden" name="port_id" value="#port_id#" />
      <button type="submit" name="post"> Post Portfolio Item </button>  
 </form>

这是我要发布到的页面 (post.cfm)

 <cfif form.before neq "">
    <cfinvoke component = "#application.cfcPath#.file" method = "upload" returnVariable = "beforeFile" theField="before">
 <cfelse>
    <cfset beforeFile = ''>
 </cfif>

 <cfif form.after neq "">
    <cfinvoke component = "#application.cfcPath#.file" method = "upload" returnVariable = "afterFile" theField="after">
 <cfelse>
    <cfset afterFile = ''>
 </cfif>    

 <cfinvoke component = "#application.cfcPath#.portfolio" method = "post" beforeFile="#beforeFile#" afterFile="#afterFile#">

 <cfif form.port_id eq 0>
    <cfset message = "The Portfolio Item has been successfully inserted.">
 <cfelse>
    <cfset message = "The Portfolio Item has been successfully updated.">
 </cfif>

 <cf_forward fuseaction="#fusebox.circuit#.home" message="#message#">

最佳答案

可能是服务器找不到上传的临时文件。

您是否尝试过不使用组件包装器进行上传?

简单

<cfif StructKeyExists(Form, "before") AND Form.before NEQ "">
<cffile
    action="upload"
    filefield="before"
    destination="#AbsPathToStoreFile#"
    >
</cfif>

<cfdump var="#cffile#">

如果失败,也许您将能够看到更多详细信息。

关于linux - ColdFusion/Linux multipart/form-data 编码文件上传问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/542396/

相关文章:

linux - Bash - 将 2 个 ssh 调用合并为 1 个(带有可选和强制命令)

php - 如何实现大批量的高性能批量图像转换?

mysql - 错误 : 'Can' t connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' -- Missing/var/run/mysqld/mysqld. socks

php - 使用字符串引用时,只有字符串的第一个单词出现在 HTML 表单中

mod-rewrite - mod_rewrite 将多个请求发送回 Lucee 服务器

string - 如何比较两个列表并找出它们之间的差异?

javascript - 使用 Javascript 和 ColdFusion 链接备注和注释

mysql - 大量的二进制数据可以存储在数据库中吗?

php - 不使用表单或 session 发送 php 值?

forms - Firemonkey 的多种表单在窗口菜单中显示多个项目