The reason for this: request.vars.file.file.read())
is that in web2py the input file is buffered in a temporary file and you can read it a little bit at the time. This allows you to read large files that do not fit in ram. Massimo On Mar 15, 3:19 pm, Michael Wales <[email protected]> wrote: > I eventually figured it out - coming from PHP I expected the file to > be stored in a temporary location, rather it is stored as a Python > File Object. This worked out well for me: > > dest_file = open(os.path.abspath(request.folder + 'static/images/' + > request.vars.file.filename), 'wb') > dest_file.write(request.vars.file.file.read()) > dest_file.close() > > On Mar 15, 2:13 pm, Yarko Tymciurak <[email protected]> wrote: > > > You can define your own form, and do your own validation in your own > > business logic code, and store as you wish.... You could use the FORM > > convenience methods. > > Note that SQLForm does all - sets up the required form content (business > > logic) to pass on to the view to render, sets up validation (business > > logic), and more... > > > On Sun, Mar 15, 2009 at 11:58 AM, Michael Wales <[email protected]>wrote: > > > > Does web2py handle file uploads when not using SQLFORM? I submit the > > > form, the request.vars.file variable contains the original filename of > > > the file, but nothing gets placed in the uploads directory. > > > > I guess my question is - I want to handle the file upload, movement to > > > a directory, and database input myself - and I don't want to define a > > > form in my controller (because a form is not business logic). Any > > > thoughts? Where does web2py place the uploaded file temporarily, > > > before it renames/moves it into the uploads/ directory? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

