RE: File upload

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

RE: File upload

John Winn
RE: [grails-user] File upload

Hi,
I found the same thing, but the best way was to use the UploadCommand example provided to retrieve a byte array.

cheers,

John


-----Original Message-----
From: Alan Kang [[hidden email]]
Sent: Sat 10/06/2006 2:21 AM
To: [hidden email]
Subject: Re: [grails-user] File upload

Thank you. It works, and I filed the issue.

Thank you again, Graeme.

Regards

On 6/10/06, Graeme Rocher <[hidden email]> wrote:
> Ok I see the problem, its because we're wrapping the actual request
> object in a HttpServletRequestWrapper.. although i don't understand
> why bind would work :-/
>
> Can you file an issue and in the meanwhile use one of the binding examples
>
> Cheers
> Graeme
>
> On 6/9/06, Alan Kang <[hidden email]> wrote:
> > Hi, all
> >
> > I'm trying HTTP file upload(
> > http://docs.codehaus.org/display/GRAILS/Controllers ), but it doesn't
> > seem to work. The example in above link says:
> >
> > ----
> > @Property upload = {
> >     def f = request.getFile('myFile')
> >     if(!f.empty) {
> >       f.transferTo( new File('someotherloc') )
> >     }
> >     else {
> >        flash.message = 'file cannot be empty'
> >        redirect(action:'uploadForm')
> >     }
> > }
> > ----
> >
> > But when I execute above code, following error occures:
> >
> > ----
> > No signature of method
> > org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile()
> > is applicable for argument types: (java.lang.String) values:
> > {"myFile"}
> > ----
> >
> > I'm doing it with lastest CVS version of Grails, and Java 1.5 on Windows XP.
> >
> > Regards
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: File upload

Alan Kang
Thanks, it works.

On 6/10/06, John Winn <[hidden email]> wrote:

>
>
>
> Hi,
>  I found the same thing, but the best way was to use the UploadCommand
> example provided to retrieve a byte array.
>
>  cheers,
>
>  John
>
>
>
>  -----Original Message-----
>  From: Alan Kang [mailto:[hidden email]]
>  Sent: Sat 10/06/2006 2:21 AM
>  To: [hidden email]
>  Subject: Re: [grails-user] File upload
>
>  Thank you. It works, and I filed the issue.
>
>  Thank you again, Graeme.
>
>  Regards
>
>  On 6/10/06, Graeme Rocher <[hidden email]> wrote:
>  > Ok I see the problem, its because we're wrapping the actual request
>  > object in a HttpServletRequestWrapper.. although i don't understand
>  > why bind would work :-/
>  >
>  > Can you file an issue and in the meanwhile use one of the binding
> examples
>  >
>  > Cheers
>  > Graeme
>  >
>  > On 6/9/06, Alan Kang <[hidden email]> wrote:
>  > > Hi, all
>  > >
>  > > I'm trying HTTP file upload(
>  > > http://docs.codehaus.org/display/GRAILS/Controllers ),
> but it doesn't
>  > > seem to work. The example in above link says:
>  > >
>  > > ----
>  > > @Property upload = {
>  > >     def f = request.getFile('myFile')
>  > >     if(!f.empty) {
>  > >       f.transferTo( new File('someotherloc') )
>  > >     }
>  > >     else {
>  > >        flash.message = 'file cannot be empty'
>  > >        redirect(action:'uploadForm')
>  > >     }
>  > > }
>  > > ----
>  > >
>  > > But when I execute above code, following error occures:
>  > >
>  > > ----
>  > > No signature of method
>  > >
> org.codehaus.groovy.grails.web.servlet.GrailsHttpServletRequest.getFile()
>  > > is applicable for argument types: (java.lang.String) values:
>  > > {"myFile"}
>  > > ----
>  > >
>  > > I'm doing it with lastest CVS version of Grails, and Java 1.5 on
> Windows XP.
>  > >
>  > > Regards
>  > >
>  > >
> ---------------------------------------------------------------------
>  > > To unsubscribe from this list please visit:
>  > >
>  > >     http://xircles.codehaus.org/manage_email
>  > >
>  > >
>  >
>  >
> ---------------------------------------------------------------------
>  > To unsubscribe from this list please visit:
>  >
>  >     http://xircles.codehaus.org/manage_email
>  >
>  >
>
> ---------------------------------------------------------------------
>  To unsubscribe from this list please visit:
>
>      http://xircles.codehaus.org/manage_email
>
>
>
>
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email