coldfusioncfzip

cfzip any way to pause page processing until the zip creating is complete?


I have some code that creates a zip file of some image and then right after that code it tries to download the file. This works fine when the zip file is very small but when it is larger it tries to download the file before it is actually completed being created.

So something like this

<CFZIP code here>

<cfset TheFileName = "#ReReplace(GetImage.ItemNum, " ", "-", "ALL")#.zip">

<cfheader name="Content-disposition" value="attachment;filename=#TheFileName#">
<cfcontent type="application/zip, application/x-zip, application/x-zip-compressed, application/octet-stream, application/x-compress, application/x-compressed, multipart/x-zip" file="#APPLICATION.ProductImageDirectory#\full-brands\#TheFileName#">

Solution

  • I found the issue. I was writing the zip file to one directory and then trying to download it from another. The strange thing was I would have expected a 404 not found message but it basically just delivered me an empty zip file anyway. Either way, problem solved.