# model
db.define_table('srcfile',
  Field('name','upload',length=50,label=T('Upload
file'),autodelete=True,
    uploadseparate=True,
    requires=(
      IS_UPLOAD_FILENAME(extension='pdf|txt|doc|htm|html|xml|ppt'),
      IS_LENGTH(5000000,10))
    ),
  )

# controller
...
file_form=SQLFORM.factory(db.auth_user,db.othertable,db.srcfile)
...
if
file_form.accepts(request.vars,formname='file_form',onvalidation=check_file_in):
     db.srcfile.insert(
        name=db.srcfile.name.store(
          request.vars.name.file,request.vars.name.filename),
        )
...

Problem is, file gets uploaded into
  no_table.name/a2/
no_table.name.a24060930d31d0c1.313234363931322e747874.txt
prior to the insert. After the insert, there is a folder
  srcfile.name/b1/srcfile.name.b192a5e35dc5081e.
313234363931322e747874.txt
except that the file is empty.

Question: is this a bug, or do I need to explicitly copy from the
source to the destination? If the latter, what would the rationale be
for creating the destination file without copying the contents from
the source?

Reply via email to