I'm trying to emulate the file upload code from the grails website, and I'm running into some problems. I'm using the same code as found here. Here is my code:
<g:form action="upload" method="post" enctype="multipart/form-data">
<input type="file" name="myFile" />
<input type="submit" value="Upload" />
</g:form>
and
def upload = {
def f = request.getFile('myFile')
if(!f.empty) {
flash.message = 'success'
}
else {
flash.message = 'file cannot be empty'
}
}
I'm receiving the following error at runtime:
Message: No signature of method: org.mortbay.jetty.Request.getFile() is applicable for argument types: (java.lang.String) values: {"myFile"}
Caused by: groovy.lang.MissingMethodException: No signature of method: org.mortbay.jetty.Request.getFile() is applicable for argument types: (java.lang.String) values: {"myFile"}
It appears to be related to some Spring configuration. Spring does not appear to be inject MultipartHttpServletRequest, so my request doesn't have the appropriate method. I just created this applications using 'grails create-app.' I have not modified the resources.groovy file. I'm using grails 1.0.3.
Any help is much appreciated. The grails website makes this look so easy.
Andrew