i am using mongoDB database to store data, and grails project.
i am able to save uploaded file in database but i am not able to makeout how to fetch that attachment from database and show to user as 'attachment' : which onclick can be downloaded.
i am attaching my code to save my uploaded file. please suggest to solve my problem.
controller code :
def save_task()
{
def task = new Task()
bindData(task, params, [except:"task_attachment"])
task.project_id= session.id_of_project
task.employee_id = params.int('employee_id')
def file = request.getFile('task_attachment')
task.task_status_percentage = 0
task.task_attachment = file.getBytes()
task.save()
task.errors.allErrors.each { println it }
session.task_list.add(task)
}