I\'m a Grails beginner, so please be patient with me. Currently I\'m having hard times manipulating file uploads. As far as I understand using request.getFile()
I c
All the information is contained in the CommonsMultipartFile object that you can cast your request parameter to.
You can use it like that (in your controller)
def uploaded = {
def CommonsMultipartFile uploadedFile = params.fileInputName
def contentType = uploadedFile.contentType
def fileName = uploadedFile.originalFilename
def size = uploadedFile.size
}
As far as blocking large file uploads, this could be done by adding the following to your form:
but not all browsers will support it. The other limit is you container upload limit (see Tomcat configuration or whatever container you are using).
Other than that, you have to check the size and reject it in the controller.