ColdFusion handling of HTML5 lt;input type=quot;filequot; multiple=quot;multiplequot; /gt;(HTML5的ColdFusion处理输入类型=“文件多个=“多个;/gt;)
问题描述
我正在尝试实现一个 HTML5 输入字段,让用户选择要上传的多个文件.我的表单中有以下内容:
I am trying to implement an HTML5 input field that lets the user select multiple files to upload. I have the following in my form:
<form method="post" enctype="multipart/form-data" action="index.cfm">
<input type="file" name="Images" id="Images" multiple="multiple" accept="image/jpeg, image/gif, image/png, application/zip" />
...
我可以在浏览器中选择多个文件,然后单击上传,但我不确定如何使用 ColdFusion 处理表单发布.我认为以下方法会起作用,但这只会上传我选择的最后一个文件:
I am able to select multiple files in the browser, then click upload, but I'm not sure how to handle the form post with ColdFusion. I thought the following would work, but this only uploads the last file I selected:
<cfloop list="#attributes.Images#" index="Image">
<cffile
destination = "#ExpandPath(Trim(request.TempFolder))#"
filefield = "Images"
action = "upload"
nameconflict = "MakeUnique"
result = "UploadedTempFile"
>
<cfoutput>#UploadedTempFile.serverFile#<br /></cfoutput>
</cfloop>
有人可以向我解释如何遍历通过我的一个表单字段提交的所有文件,以便我可以单独处理这些文件吗?
Can someone explain to me how to loop through all the files submitted through my one form field so I can handle the files individually?
推荐答案
更新:从 ColdFusion 9 开始,这是真的.这已在 ColdFusion 10 中得到纠正.
UPDATE: As of ColdFusion 9 this was true. This has been corrected in ColdFusion 10.
结束我们的评论对话:
这对于默认的 ColdFusion 行为是不可能的.cffile
不支持从单个 file
元素处理多个文件上传.我认为有可能回退到 JAVA 来做到这一点,但我不知道如何做到这一点.
This simply isn't possible with default ColdFusion behavior. cffile
doesn't support handling multiple file uploads from a single file
element. I think it could potentially be possible to fallback to JAVA to do this, but I wouldn't have a clue how to make that happen.
我希望 cffile action="uploadall"
获取所有 HTML5 多文件元素.需要将其归档为 CF10 的 ER :).
I would love cffile action="uploadall"
to grab all HTML5 multi-file elements. Will need to file that as an ER for CF10 :).
这篇关于HTML5的ColdFusion处理<输入类型=“文件"多个=“多个";/>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:HTML5的ColdFusion处理<输入类型=“文件"多个
基础教程推荐
- 自定义 XMLHttpRequest.prototype.open 2022-01-01
- 如何使用JIT在顺风css中使用布局变体? 2022-01-01
- Vue 3 – <过渡>渲染不能动画的非元素根节点 2022-01-01
- 如何使用TypeScrip将固定承诺数组中的项设置为可选 2022-01-01
- Chart.js 在线性图表上拖动点 2022-01-01
- html表格如何通过更改悬停边框来突出显示列? 2022-01-01
- 我可以在浏览器中与Babel一起使用ES模块,而不捆绑我的代码吗? 2022-01-01
- Electron 将 Node.js 和 Chromium 上下文结合起来意味着 2022-01-01
- 用于 Twitter 小部件宽度的 HTML/CSS 2022-01-01
- 直接将值设置为滑块 2022-01-01