in web2py book:
In the case of a table including an "upload"-type field ("fieldname"), both 
process(dbio=False) and validate() deal with the storage of the uploaded 
file as if process(dbio=True), the default behavior.

it means that I cannot delay the upload?

model based on Massimo examples:

db.define_table('allfiles',
    Field('filename', readable=False, writable=False),
    Field('filepath', readable=False, writable=False),
    Field('parentpath', readable=False, writable=False),
    Field('filetype', readable=False, writable=False),
    Field('file','upload',uploadfolder=os.path.normpath(r'c:\caminho'), 
label='arquivos'),
    Field('content','text', readable=False, writable=False),
    Field('datecreated','datetime',default=now, readable=False, 
writable=False),
    Field('datemodified','datetime',default=now, readable=False, 
writable=False),
    Field('filesize','integer', readable=False, writable=False),
    Field('user',db.auth_user,default=me, readable=False, writable=False))

Using this with SQLFORM and only showing the upload field. 

After validate()  I validate some inputs and then insert in db. but its 
creating two files in file system. One its from my insert and other that 
ignores dbio=False when processing the form.

What am I missing?

Its possible to use a sqlform.factory with only a upload field that can use 
validators and file system names used by this model?

-- 



Reply via email to