I did something similar to the following:
Assuming your download page has an appropriate instance of Submissions ...
<g:link action="downloadFile" id="${aSubmission.id}"> <img>...etc...</img> </g:link>
Then in the controller (is your "location" the path to the file?):
def downloadFile = { def sub = Submissions.get(params.id) def file = new File("${sub.location}/${sub.fileName") 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 } else render "Error!" // appropriate error handling }
Chris source share