I am trying to upload images and here is my code for handling file upload:

def POST(self):
>         temp = web.input(myfile={})
>         filedir = '/home/daidq/web.py/upload/images'
>         if 'myfile' in temp:
>             filepath = temp.myfile.filename.replace('\\','/')
>             filename = filepath.split('/')[-1]
>             fout = open(filedir +'/'+ filename,'w')
>             fout.write(temp.myfile.file.read())
>             fout.close()
>         raise web.seeother('/gallery')
>

But the problem is that it keeps show me error: *name 'temp' is not defined*at 
*if 'myfile' in temp:* line

Please help me to get over this.

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to webpy+unsubscr...@googlegroups.com.
To post to this group, send email to webpy@googlegroups.com.
Visit this group at http://groups.google.com/group/webpy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to