# model
db.define_table('doc',
  Field('title','string'),
  Field('filename','upload')
)

#controller
text_form=SQLFORM.factory(Field('text_in','text',db.doc))
file_form=SQLFORM.factory(db.doc)
...
if text_form.accepts(request.vars,formname='text_form'):
  #insert data into the doc table
 ...
if file_form.accepts(request.vars,formname='file_form'):
  # etc

The view has custom forms for both text_form and file_form.

The question is ... how to properly insert data into the doc table in
the case of the text_form? text_form.vars.text_in has the results of
textarea form field. These data are easily stored in an uploads/
file.txt file. The question is how to make the db.doc.filename field
point to the uploads/file.txt file such that it will be consistent
with a true file upload vs. a text field upload? Just inserting the
name of the uploads/file.txt into the db.doc.filename field isn't the
right way. (Hope this is clear enough.)
-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@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