Hi Yarko, thanks for the response.

I may already have this section memorized, by now from having read it
around 100000 times ;^) But this is not the answer I'm looking for.
Let me explain...

# db:
db.define_table('table1',Field('filename','upload'))

# view
form=SQLFORM.factory(Field('text_in','text',requires=IS_NOT_EMPTY
()), ...)

# Now I'm going to take the text_in and write it to a file:
if form.accepts(request.vars,session,onvalidation=validate_form):
  # now store the newfilename in table1
  fields=dict(filename=form.vars['filename_newfilename'], ...)
  db.table1.insert(**fields)
  db.commit()

def validate_form(form):
  form.vars['filename_newfilename']=create_file(form)
  return form

# create_file makes a unique file with some crypted string and a .txt
suffix.
def create_file(form):
  # generate unique new filename in uploads folder
  # write text input into file
  # return new filename

Question is ... where is this going wrong?
--~--~---------~--~----~------------~-------~--~----~
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