title: storing original upload filename (web2py)
body: <p>I'm attempting to do something simple and documented well, except for that it's not working on my web app.</p>
  
  <p>essentally i want to save some extra attributes for the uploaded files, like original filename, email of user and also the upload date.</p>
  
  <p>Now following the web2py documentation i've created this submit view. It is almost word for word copied from the documentation section <a href="http://www.web2py.com/books/default/chapter/29/07/forms-and-validators#Storing-the-original-filename" rel="nofollow">here</a></p>
  
  <p>I have a controller data.py</p>
  
  <pre><code>def submit():
  
    import datetime
  
    form = SQLFORM(db.uploads, fields=['up_file'], deletable=True)
  
    form.vars.up_date = datetime.datetime.now()
    form.vars.username = auth.user.email
  
    if request.vars.up_file != None:
      form.vars.filename = request.vars.up_file.filename
  
    if form.process().accepted:
      redirect(URL('data', 'index'))
    elif form.errors:
      response.flash = "form has errors"
  </code></pre>
  
  <p>and my db.py excerpt:</p>
  
  <pre><code>db.define_table('uploads',
      Field('username', 'string'),
      Field('filename', represent = lambda x, row: "None" if x == None else x[:45]),
      Field('up_file', 'upload', uploadseparate=True, requires=[IS_NOT_EMPTY(), IS_UPLOAD_FILENAME(extension=ext_regex)]),
      Field('up_date', 'datetime'), 
      Field('up_size', 'integer', represent= lambda x, row: quikr_utils.sizeof_fmt(x) ), 
      Field('notes', 'text'))
  </code></pre>
  
  <p>Currently the validation doesn't appear to do anything, when I submit my function, the filename isn't getting saved for some reason, and i get an error elsewhere because the value is None</p>