stuart clayman
2006-12-05 17:12:33 UTC
I am trying to convert some file upload functionality from normal forms to
Ajax forms.
I have had success doing file upload using the approach outlined in the
online docs:
<g:form action="upload_handler" method="post"
enctype="multipart/form-data">
....
<input type="file" name="uploadFile" size="60" />
.....
</g:form>
In my controller I have:
def file = request.getFile('uploadFile')
which all works fine.
I replaced the g:form line for
<g:formRemote name="upload_form" url="[action:'upload_handler']"
onLoading="spinner('upload_results')"
update="[success:'message',failure:'error']" method="post"
enctype="multipart/form-data">
The behaviour I get is that data is uploaded, but I'm not conviced it gets
sent as a multipart form.
I think the data is being passed in slightly differently because I get the
following error messages:
[groovy] org.codehaus.groovy.runtime.InvokerInvocationException:
groovy.lang.MissingMethodException: No signature of method
org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile() is
applicable for argument types: (java.lang.String) values: {"uploadFile"}
.....
[groovy] Caused by: groovy.lang.MissingMethodException: No signature of
method
org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile() is
applicable for argument types: (java.lang.String) values: {"uploadFile"}
Does anyone have any ideas, or have they had success doing Ajax file upload
stuart
Ajax forms.
I have had success doing file upload using the approach outlined in the
online docs:
<g:form action="upload_handler" method="post"
enctype="multipart/form-data">
....
<input type="file" name="uploadFile" size="60" />
.....
</g:form>
In my controller I have:
def file = request.getFile('uploadFile')
which all works fine.
I replaced the g:form line for
<g:formRemote name="upload_form" url="[action:'upload_handler']"
onLoading="spinner('upload_results')"
update="[success:'message',failure:'error']" method="post"
enctype="multipart/form-data">
The behaviour I get is that data is uploaded, but I'm not conviced it gets
sent as a multipart form.
I think the data is being passed in slightly differently because I get the
following error messages:
[groovy] org.codehaus.groovy.runtime.InvokerInvocationException:
groovy.lang.MissingMethodException: No signature of method
org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile() is
applicable for argument types: (java.lang.String) values: {"uploadFile"}
.....
[groovy] Caused by: groovy.lang.MissingMethodException: No signature of
method
org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile() is
applicable for argument types: (java.lang.String) values: {"uploadFile"}
Does anyone have any ideas, or have they had success doing Ajax file upload
stuart
--
View this message in context: http://www.nabble.com/File-Upload-and-g%3AformRemote-tf2762970.html#a7703569
Sent from the grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email
View this message in context: http://www.nabble.com/File-Upload-and-g%3AformRemote-tf2762970.html#a7703569
Sent from the grails - user mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe from this list please visit:
http://xircles.codehaus.org/manage_email