Anyone know the cfzip script syntax for ACF 2021 u...
# cfml-general
h
Anyone know the cfzip script syntax for ACF 2021 using cfzipparam? I can make it work with tag syntax, but would rather use cfscript. The following results in the error "No source specified in cfziptag."
Copy code
cfzip(file = 'c:\files\pictures.zip') {
    cfzipparam(source = "c:\files\picture.jpg");
}
This works fine:
Copy code
<cfzip file = "c:\files\pictures.zip">
    <cfzipparam source = "c:\files\picture.jpg">
</cfzip>
g
From Adobe docs : try
Copy code
cfzip(file = "absolute pathname", source = "source directory" 
        (cfzipparam source = "source directory"..), 
            encryptionAlgorithm = "standard|AES-128|AES-256", password = "password string", action = "zip", filter = "file filter", overwrite = "yes|no", prefix = "string", recurse = "yes|no", storePath = "yes|no")
b
I fired this up in CommandBox and it works like you expect:
Copy code
<cfscript>
    cfzip( file = expandPath( "./files.zip" ) ) {
        cfzipparam( source = expandPath( "./file.txt" ) );
    }
</cfscript>
Actually that was in Lucee because I gave the wrong start syntax... let me try it correctly in CF2021...
What's the exact error message you're getting back?
h
"No source specified in cfziptag." is the error message I receive.
If I add the source attribute to the cfzip, then it just copies all files that exist in the source path:
Copy code
cfzip(file = 'c:\files\pictures.zip', source = 'c:\files\') {
    cfzipparam(source = "c:\files\picture.jpg");
}
instead of just adding the one file, picture.jpg
The script example from Adobe's docs with cfzipparam is a mess. cfzipparam in parenthesis in the middle of the attributes?... I'm submitting a bug tracker for this as this just doesn't work in script form.
b
I think the code I showed above worked correctly in CF2021 on CommandBox. Away from a computer at the moment, so I can’t confirm.
h
Thanks Mark. I'll see if Adobe has any ideas as this behavior is on my full patched dev server. It works fine on my Lucee servers. I haven't tested it on my production servers (obvs).