Du skal hente InputStream fra MultipartFile du er bestået som vist i dokumentationen:
<g:uploadForm action="upload">
<input type="file" name="filecsv" />
<input type="submit" />
</g:uploadForm>
Så;
def upload = {
request.getFile( 'filecsv' )
.inputStream
.splitEachLine(',') { fields ->
def city = new City( city: fields[0].trim(),
description: fields[1].trim() )
if (city.hasErrors() || city.save(flush: true) == null) {
log.error("Could not import domainObject ${city.errors}")
}
log.debug("Importing domainObject ${city.toString()}")
}
}