Converting String to File: I am passing a file to an action in controller
redirect(action:"downloadFile", params:[file:temp_file])
But when I do
def file = params.file
file.getName();
It give me error cannot cast object 'java.lang.String' to 'java.io.File'
How to convert String to File?
If your
params.fileis a file that user’re uploading, you have to use following:please read more about file upload in Grails
If you’re trying to send this file to user’s browser then: