hi,
you can use request.vars.media.filename to access the original name of
the file like this:
form = FORM('Upload file',
TABLE(
TR(INPUT(_name='media', _type='file', requires=IS_NOT_EMPTY
())),
TR(INPUT(_type='submit', _value='Upload')),
)
)
if form.accepts(request.vars, session):
filename = ...
size = int(request.env.content_length)
gluon.fileutils.copystream(request.vars.media.file, open
(filename, 'wb'), size) # stream file to reduce memory usage of server
db.media.insert(current_filename=filename,
original_filename=request.vars.media.filename, size=size)
That is what I currently use - please tell me if there is a better
way.
Richard
On Aug 14, 2:58 pm, weheh <[email protected]> wrote:
> I want to open the uploaded file, parse it, and then delete it. But
> I'm having trouble figuring out which variable has the name of the
> upload file. I know it's probably something really stupidly simpe that
> I should know, but I can't find it easily in the doc.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---