This is not a trivial question. Say you have
db.define_table('data',Field('atob','upload'))
form=crud.create(db.data, onaccept=process_file)
Here is an example of a process the atob upload field and replaces 'a'
with 'b'.
def process_file(form):
filename = form.vars.atob_newfilename
path = os.path.join(db.data.atob.uploadfolder,filename)
text = oepn(path,'rb').read()
text = re.compile('a').sub('b',text)
text = open(path,'wb').write(text)
Hope it makes sense.
On Nov 22, 10:17 am, Daniel Antonio Aguayo Catalán
<[email protected]> wrote:
> Hello,
>
> I need to pass some regexp through a file just after being uploaded, for
> then save the results in a dict or something, but I have problems to
> realize the code for this because I'm just learning python while using
> web2py.
>
> Any help is appreciated.
>
> Thanks in advance :)
>
> Regards
>
> --
> Daniel Antonio Aguayo Catalán <[email protected]>
> Chile
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---