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
// Given the controller | |
class DemoController { | |
def hello() { | |
render "greetings!" | |
} | |
def greet() { | |
redirect action: 'hello' | |
} | |
} |
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
// In your controller, use the following code | |
// Single file | |
def file = request.getFile("identifier_name_in_html_tag_attribute") | |
// Useful information | |
file.empty | |
file.class // => class org.springframework.web.multipart.support.StandardMultipartHttpServletRequest$StandardMultipartFile | |
file.name // the name attribute value you used above (comes from html input tag) | |
file.originalFilename |
OlderNewer