Created
January 6, 2012 15:13
-
-
Save jdmr/1571001 to your computer and use it in GitHub Desktop.
Groovy Upload File Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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