Answers for "ColdFusion Zip and Download Directory"

0

ColdFusion Zip and Download Directory

<cfset fileName = createUUID() />
<cfif DirectoryExists("D:/tempDir")>
    <cfdirectory action = "list" directory = "D:/tempDir" name = "getAllFiles"  type="file" />
        <cfzip action="zip" file="D:/zipfilefolder/#fileName#.zip" overwrite="yes" >
            <cfloop query="getAllFiles">    
                <cfzipparam  source="D:/tempDir/#getAllFiles.name#">
            </cfloop>
        </cfzip>
</cfif>
<cfcontent deleteFile="true" file="D:/zipfilefolder/#fileName#.zip" type="application/x-zip-compressed" >
<cfheader name = "Content-disposition" value = 'attachment; filename="D:/zipfilefolder/#fileName#.zip"'>
Posted by: Guest on April-19-2021

Browse Popular Code Answers by Language