Skip to content

Commit f8926c1

Browse files
author
Andrew Valums
committed
Updated coldfusion example. Thanks to Sidney Maestre.
1 parent 2c63c15 commit f8926c1

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

readme.md

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ probably see a reason there.
140140

141141
Thanks to everybody who contributed, either by sending bug reports or donating. And special thanks to:
142142

143+
Sidney Maestre
143144
Patrick Pfeiffer
144145
Sean Sandy (SeanJA)
145146
Andy Newby

server/coldfusion/coldfusion.cfc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<cfcomponent hint="I handle AJAX File Uploads from Valums' AJAX file uploader library"> <cffunction name="upload" access="remote" output="false" returntype="void"> <cfargument name="qqfile" type="string" required="true"> <!--- get the http request data, use Firebug in Firefox to see the raw http header data ---> <cfset x = GetHttpRequestData()> <!--- write the contents of the http request to a file. The filename is passed with the qqfile variable ---> <cffile action="write" file="#ExpandPath('.')#/#arguments.qqfile#" output="#x.content#" > <!--- if you want to return some JSON you can do it here. I'm just passing a success message ---> <CFCONTENT TYPE="text" RESET="Yes"><cfoutput>{success:true} <cfsetting showdebugoutput="false" /></cfoutput><cfabort> </cffunction> </cfcomponent>
1+
<!---AJAX FileUploader for ColdFusionversion: 1.1feedback: [email protected]---><cfcomponent hint="I handle AJAX File Uploads from Valum's AJAX file uploader library"> <cffunction name="Upload" access="remote" output="false" returntype="any" returnformat="JSON" > <cfargument name="qqfile" type="string" required="true"> <cfset x = GetHttpRequestData()> <!--- check if XHR data exists ---> <cfif len(x.content) gt 0> <cfreturn UploadFileXhr(arguments.qqfile,x.content) /> <cfelse> <!--- no XHR data process as standard form submission ---> <cffile action="upload" fileField = "qqfile" destination ="#ExpandPath('.')#" nameConflict = "makeunique" /> <cfset msgStruct['success']= true /> <cfset msgStruct['type']= 'form' /> <cfreturn serializeJSON(msgStruct) /> </cfif> </cffunction> <cffunction name="UploadFileXhr" access="private" output="false" returntype="any"> <cfargument name="qqfile" type="string" required="true"> <cfargument name="content" type="any" required="true"> <!--- write the contents of the http request to a file. The filename is passed with the qqfile variable ---> <cffile action="write" file="#ExpandPath('.')#/#arguments.qqfile#" output="#content#" > <!--- if you want to return some JSON you can do it here. I'm just passing a success message ---> <cfset msgStruct['success']= true /> <cfset msgStruct['type']= 'xhr' /> <cfreturn serializeJSON(msgStruct) /> </cffunction> </cfcomponent>

server/coldfusion/demo.cfm

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="fileuploader.css" rel="stylesheet" type="text/css"> <style> body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;} </style> </head><body> <h1>ColdFusion File Uploader Demo</h1> <p><a href="http://github.com/valums/file-uploader">Back to project page</a></p> <p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p> <p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p> <div id="file-uploader-demo1"> <noscript> <p>Please enable JavaScript to use file uploader.</p> <!-- or put a simple form for upload here --> </noscript> </div> <script src="fileuploader.js" type="text/javascript"></script> <script> function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-demo1'), action: '/valums/server/coldfusion/coldfusion.cfc', params: {method: 'upload'} }); } // in your app create uploader as soon as the DOM is ready // don't wait for the window to load window.onload = createUploader; </script> </body></html>
1+
<!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link href="fileuploader.css" rel="stylesheet" type="text/css"> <style> body {font-size:13px; font-family:arial, sans-serif; width:700px; margin:100px auto;} </style> </head><body > <h1>ColdFusion File Uploader Demo</h1> <p><a href="http://github.com/valums/file-uploader">Back to project page</a></p> <p>To upload a file, click on the button below. Drag-and-drop is supported in FF, Chrome.</p> <p>Progress-bar is supported in FF3.6+, Chrome6+, Safari4+</p> <div id="file-uploader-demo1"> <noscript> <p>Please enable JavaScript to use file uploader.</p> <!-- or put a simple form for upload here --> </noscript> </div> <script src="fileuploader.js" type="text/javascript"></script> <script> function createUploader(){ var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-demo1'), action: '/valums/server/coldfusion.cfc', params: {method: 'Upload'} }); } // in your app create uploader as soon as the DOM is ready // don't wait for the window to load window.onload = createUploader; </script> </body></html>

0 commit comments

Comments
 (0)