The problem is I am trying to get the file from the function in
SQLFORM.onvalidation... and this happens before the file gets renamed or
saved to the disk. The only way i see of accomplishing this is
if form.accepts(request.vars, session, dbio=False):
#def is_plugin_archive(form)
#import tarfile, os
#path = os.path.join(db._folder, '..', 'uploads',
form.vars.file_newfilename)
#if not tarfile.is_tarfile(path):
#form.errors.file = "Not a valid tar archive"
is_plugin_archive(form)
if not form.errors:
session.flash = "Version uploaded."
redirect(URL(r=request, f='plug', args=plugin.id))
else:
response.flash = "There were errors with the file"
elif form.errors:
response.flash = "There were errors"
-Thadeus
On Mon, Nov 23, 2009 at 9:46 PM, mr.freeze <[email protected]> wrote:
> ieve it is form.vars.<upload_field>_newfilename. You should be
> able to get the path
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---