I have this functioning code and i just want to download it as zip instead of its orginal file Here is my code:
def downloadFile() {
def filePath=ServletContextHolder.servletContext.getRealPath("/") + "Audio/"
def sub = AudioClips.get(params.id)
filePath+=sub.fileName
def file = new File(filePath);
if (file.exists())
{
response.setContentType("application/octet-stream") // or or image/JPEG or text/xml or whatever type the file is
response.setHeader("Content-disposition", "attachment;filename=\"${file.name}\"")
response.outputStream << file.bytes
redirect(controller: "category",action: "index")
}