a simple skeleton code (please check for errors):

def page_controller():
form = FORM( TABLE (
TR(
TD(LABEL('Upload File:')),
TD(INPUT(_type='file', name='myfile', id='myfile', requires=IS_NOT_EMPTY()))
),
TR(
TD(INPUT(_type='submit',_value='Submit'))
)
)
)

txt_content[]
if form.process().accepted:
txt_content = request.vars.myfile.file.readlines()
msg = process_file(txt_content)
response.flash = T(msg)
elif form.errors:
response.flash = T('some errors occurred')
else:
pass

return dict(form=form)

def process_file(txt_content):
all_lines = txt_content
msg = 'txt not processed'
for line in all_lines:
try:
..... your processing code .....
msg = 'txt processed succesfully'
except:
..... your processing code .....
msg = 'error processing txt'
return msg

Il giorno mercoledì 31 ottobre 2012 16:45:19 UTC+1, praveen krishna ha 
scritto:
>
> Hi,
>    For my task I have to upload a text file in form with out zipping it ,I 
> have prepared the form as: 
> form = FORM(TABLE(TR(TD('Upload File:', INPUT(_type='file', name='myfile', 
> id='myfile', 
> requires=IS_NOT_EMPTY()))),TR(TD(INPUT(_type='submit',_value='Submit')))))
>
> But I unable to read the file how could it be possible without using 
> ZipFile.
>

-- 



Reply via email to