def POST(self,page): if page == "upload": x = web.input(myfile={}) filedir = '/path/where/you/want/to/save' # change this to the directory you want to store the file in. if 'myfile' in x: # to check if the file-object is created filepath=x.myfile.filename.replace('\\','/') # replaces the windows-style slashes with linux ones. filename=filepath.split('/')[-1] # splits the and chooses the last part (the filename with extension) fout = open(filedir +'/'+ filename,'w') # creates the file where the uploaded file should be stored fout.write(x.myfile.file.read()) # writes the uploaded file to the newly created file. fout.close() # closes the file, upload complete. elif page == "speak": words = web.input() from modules.Node import Node node = Node('flame_node','local') if words.body == u"" or words.id == u"": raise web.seeother('/user/contact') else: body = str(words.body.encode('utf-8','ignore')) id = int(words.id.encode('utf-8','ignore')) node.add(author=id,content=body,scope=id) raise web.seeother('/user/contact') else: raise web.seeother('/user/briefing')