Reputation: 992
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
Upvotes: 0
Views: 1178
Reputation: 338336
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.Upvotes: 3