I do not fully understand the workflow.
I assume the problem is that exposecsv() cannot find the file.
Correct? What is in request.args(0)?
How were the files uploaded?

massimo

On Apr 1, 7:14 am, Limesle <jbsoube...@gmail.com> wrote:
> Hello,
>
> as you know, Web2py transform the content and the name of a file when
> uploaded.
>
> I tried several time to expose the real content of the file
> But I always have "Fieldstorage" and other information at the
> begining. I can't get rid of this.
>
> The file content are like:
>
> FieldStorage('file_path', 'C:\\Documents and Settings\\w7774455\
> \Desktop\\test.csv', 'contentline1\r\ncontentline2\r\n')
>
> I just want to be able to expose :
>
> contentline1
> contentline2
>
> Used controllers :
>
> def listfile():
>     files = db().select(db.Files.ALL)
>     return dict (files=files)
>
> def exposecsv():
>     import csv
>     filename=request.args[0]
>     content = os.path.join(request.folder,'uploads/','%s' % filename)
>     content1 = open(content, 'r')
>     content2 = csv.reader(content1, delimiter=',')
>     return dict(content2=content2)
>
> It would be very helpful if someone have an idea.
>
> Thank for reading me.
> Limesle

Reply via email to