Would like you help on with this file upload issue. I am trying to read the contents of a file and process it during file upload (without making any changes to the file). When I try to read the file contents during an upload, the uploaded file has no contents (it is empty).
See function below and let me know if I am doing anything wrong - def UploadData(): """CSV file upload and data processer""" messg = "File successfully uploaded" # file uploads form = SQLFORM(db.mytable,fields=['file', 'filetype'],labels={'file':T('Attach files: '), 'filetype':T('Select File Type')}, showid=False) if request.post_vars.file != None: wells = request.vars.file.file.read() ## do some processing with wells if form.accepts(request.post_vars): session.flash=T(messg) else: response.flash=T("") return dict(form=form)