Skip to content

Instantly share code, notes, and snippets.

@jdmr
Created January 6, 2012 15:13
Show Gist options
  • Save jdmr/1571001 to your computer and use it in GitHub Desktop.
Save jdmr/1571001 to your computer and use it in GitHub Desktop.
Groovy Upload File Controller
def upload = {
def f = request.getFile('myFile')
if (!f.empty) {
def imagen = new Imagen(
nombre : f.originalFilename
, tipoContenido : f.contentType
, tamano : f.size
, archivo : f.bytes
).save()
response.sendError(200,'Done')
} else {
flash.message = 'file cannot be empty'
redirect(action:'uploadForm')
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment