U moet de InputStream ophalen van de MultipartFile u bent geslaagd voor zoals weergegeven in de documentatie:
<g:uploadForm action="upload">
<input type="file" name="filecsv" />
<input type="submit" />
</g:uploadForm>
Dan;
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()}")
}
}