Q:

Multipart post in grails causes 404 error

I try to upload data to a grails app.  This works very good and the object is created in the database and the uploaded document is also present.  Unfortunately i get a 404 error directly after the creation.  
I am using grails 2.3.5 with the following code:
Action to save:
@Transactional
def save(Book bookInstance) {
    if (bookInstance == null) {
        notFound()
        return
    }

    if (bookInstance.hasErrors()) {
        respond bookInstance.errors, view:'create'
        return
    }             

    if(!bookInstance.id){
        bookInstance.id = UUID.randomUUID().toString()
    }

    bookInstance.save flush:true

    request.withFormat {
        form {
            flash.message = message(code: 'default.created.message', args: [message(code: 'Book.label', default: 'Book'), bookInstance.id])
            redirect bookInstance
        }
        '*' { 
            respond bookInstance, [status: CREATED] 
        }
    }
}

GSP:
<g:uploadForm action="save" class="form-horizontal">
        <g:render template="form"/>

        <div class="form-actions margin-top-medium">
            <g:submitButton name="create" class="btn btn-primary" value="${message(code: 'default.button.create.label', default: 'Create')}" />
            <button class="btn" type="reset"><g:message code="default.button.reset.label" default="Reset" /></button>
        </div>
    </g:uploadForm>

When the  tag is used instead of the  it works.  The enctype="multipart/form-data" causes the error.  
What can I try to solve this? 
Thanks

A:

You should check conf/Config.groovy and check that multipartForm: 'multipart/form-data', is present as a value for grails.mime.types, e.g.:
grails.mime.types = [
    ...
    form: 'application/x-www-form-urlencoded',
    multipartForm: 'multipart/form-data',
]

You also need to specify that it's a multipart form in your withFormat declaration: 
request.withFormat {
    form multipartForm  

