if filename is the file from the database

   filename='config.file.924bea965800dbdf.736172697373612e6a73.js'

you can use

   data =
open(os.path.join(request.folder,'uploads',filename),'rb').read()

On 1 Lug, 08:36, Tom Chang <[email protected]> wrote:
> web2py experts,
>
> a newbie here trying to learn web2py on my first app.
>
> Basically, I want a user to upload a text file (work perfectly right
> from web2py). Then, the backend (controller) will analyze the text
> files, and then display the output back to the user.
>
> The problem I ran into is after I retrive the new filename
> information, I need to have the controller to open up the text file
> and then analyze it. I ran into the following exception:
>
>     f = open(myFile,'r').read()
> IOError: [Errno 2] No such file or directory: ''
>
> The file path is:
> /applications/IOS_Audit/uploads/config.file.924bea965800dbdf.
> 736172697373612e6a73.js
>
> So wondering my path is wrong probably? any suggestion on the right
> path to use?
>
> best regards,
> TC

Reply via email to