Coldfusion,使用 GetHttpRequestData 来存储和处理文件
我有一个 JQUERY 文件上传插件,允许用户将文件上传到 Coldfusion 服务器。该插件将文件提交到服务器的方式要求我使用 GetHttpRequestData() 来获取文件内容。这是到目前为止我在处理文件数据方面所拥有的:
<cfparam name="URL.qqfile" type="string">
<cfset x = GetHttpRequestData()>
<cffile action="write" output="#x.content#" file="c:\temp\#URL.qqfile#">
这有效,这很好,但我似乎无法将其带到下一步。
接下来我想要发生的是: A. 确定文件的扩展名。 B. 如果它是我的应用程序定义的可接受的扩展(JPG、PNG、PDF、DOC、DOCX 等),请将其上传到服务器上的正确目录。然后删除上面的临时文件 C. 如果上传的文件是图像,则使用 CFIMAGE 制作缩略图
如何通过步骤 AC 解决 GetHttpRequestData 问题?
谢谢
I have a JQUERY file upload plug-in which allows users to upload files to the Coldfusion server. The plugin submits the files to the server in a way that requires me to use GetHttpRequestData() for the files contents. Here's what I have so far in terms of handling the file data:
<cfparam name="URL.qqfile" type="string">
<cfset x = GetHttpRequestData()>
<cffile action="write" output="#x.content#" file="c:\temp\#URL.qqfile#">
This works, which is nice, but I can't seem to take this to the next step.
What I want to happen next is:
A. Determine the file's extension.
B. If it is an accepted ext defined by my app, (JPG,PNG,PDF, DOC, DOCX, etc...) upload it to the correct directory on the server. Then delete the temp file above
C. Use CFIMAGE to make a thumbnail if the file uploaded was an Image
How can I take the above through steps A-C with the GetHttpRequestData problem?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一些提示:
查看GetHttpRequestData()
的结果结构。ListLen()
、ListFirst()
、ListLast()
、ListRest()
以及适当的分隔符)轻松解析字符串。StructKeyExists()
来防止丢失结构部分。永远不要认为此结构中“通常”出现的任何内容都是理所当然的。
。
的文档。用它来制作缩略图不会那么困难。A few tips:
GetHttpRequestData()
via<cfdump>
.ListLen()
,ListFirst()
,ListLast()
,ListRest()
with appropriate delimiter chars) to easily parse the string.StructKeyExists()
to safeguard against missing struct parts. Never take for granted anything that "typically" seems to be in this struct.<cffile action="upload">
.<cfimage>
. It can't be that hard to use it to make thumbnails.