Good catch.
Alternatively you could set request.vars.filename before form.accepts
().


On Nov 20, 8:34 pm, Thadeus Burgess <thade...@thadeusb.com> wrote:
> With the above function it will try to insert the image into the database
> twice, you need.
>
> if form.accepts(request.vars, session, dbio=False)
>
> -Thadeus
>
> On Thu, Nov 19, 2009 at 10:51 AM, NuclearDragon
> <nucleardragon...@gmail.com>wrote:
>
>
>
> > Thanks for the replies everyone!
>
> > We are renaming the files with our own naming scheme, so they are
> > unique, but not random. We don't provide a download function for our
> > users, so I'm not worried about the download aspect.
>
> > Thanks especially to Richard for this!:
> > "
> > form = SQLFORM(db.image)
> > if form.accepts(request.vars, session):
> >        target_filename = ...
> >        # need to stream or large files could cripple your server
> >        gluon.fileutils.copystream(request.vars.filename.file, open
> > (target_filename, 'wb'), int(request.env.content_length))
> >        db.image.insert(filename=target_filename)
> > "
>
> > Also, I tried my first 'multiple forms page', and it worked very
> > slick! I'm really starting to like web2py, especially the
> > customization I can do within it.
>
> > Thanks for a great framework, Massimo!
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to