Try to delete change the action from action="/"to action=""
On Thu, Jun 6, 2013 at 8:21 AM, Joseph Do <[email protected]> wrote: > Here is my HTML form code: > > >> <form action="/" method="post" enctype="multipart/form-data"> >> >> <input type="file" name="myfile"> >> <input type="submit" value="Upload"> > > </form> >> > > On Thursday, June 6, 2013 11:15:12 AM UTC+7, Joseph Do wrote: >> >> 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<http://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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/webpy?hl=en. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake please let me know by reply and then delete it from your system; you should not copy the message or disclose its contents to anyone. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/webpy?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
