I have a list of pdfs I want to zip up. In the first example
below I try to loop over the list and put them into cfzipparams
within one cfzip tag. This results in a zip file with only one pdf
(the last one). In the second example I loop over the list and call
the cfzip tag once for every pdf, appending each pdf separately
onto the zip file. So, the second example works, but it seems to me
that the first example would be more efficient if it worked. Why
doesn't it work?
<cfset fileList =
"somefile.pdf|anotherfile.pdf|yetanotherfile.pdf" />
The following will only add the very last pdf to the zip
(yetanotherfile.pdf in my example).
<cfzip action="zip" file="#samplepath#.zip"
overwrite="yes">
<cfloop index="filepath" list="#fileList#"
delimiters="|">
<cfzipparam source="#filepath#">
</cfloop>
</cfzip>
The following will add all three pdfs to the zip file.
<cfloop index="filepath" list="#fileList#"
delimiters="|">
<cfzip action="zip" file="#samplepath#.zip"
overwrite="no">
<cfzipparam source="#filepath#">
</cfzip>
</cfloop>