jQuery Uploadify - checkScript Example for ColdFusion

ColdFusion , Default , Web Development Add comments

All of the programming that comes with the Uploadify plug-in for jQuery is done in PHP.  I've converted the new checkScript feature to use ColdFusion instead.

------ checkfileexists.cfm -----

<cfset returnArray = arrayNew(1) />
<cfloop list="#form.fieldnames#" index="i">
    <cfif i NEQ "folder" AND fileExists('#expandpath(form.folder)#\#form[i]#')>
            <cfset arrayAppend(returnArray,form[i]) />
    </cfif>
</cfloop>
<cfcontent reset ="true" /><cfoutput>#serializeJSON(returnArray)#</cfoutput><cfabort>

------- end checkfileexists.cfm ------

The cfcontent and cfabort tags on the last line probably aren't necessary, but they will prevent any content or spacing in the header/footer of your site from interfering with the JSON that is returned.

To call this file, you would point to it in the uploadify function.  For example:

$('#cmsUploadFile').uploadify({
                        'uploader': '/path/to/uploadify.swf',
                        'script': '/path/to/files.cfm',
                        'folder': 'myfiles',
                        'cancelImg': '/path/to/cancel.png',
                        'checkScript': '/path/to/checkfileexists.cfm'
                        });

1 response to “jQuery Uploadify - checkScript Example for ColdFusion”

  1. Brett P-R Says:
    Many thanks...

Leave a Reply

Leave this field empty:



Powered by Mango Blog. Design and Icons by N.Design Studio