Here's what I ended up with for Learning Python the Hard Way Ex 51 with image upload (save and display).The form:<div style=margin:300px;border:1px solid #000><form method=POST enctype=multipart/form-data action=upload>A Greeting: <input type=text name=greet><br/>Your Name: <input type=text name=name><br/>Image file: <input type=file name=myfile /><br/><input type=submit /></form></div>The app:import webimport shutilimport osurls = (    '/', 'Index',    '/images/(.*)', 'images' #this is where the image folder is located....)app = web.application(urls, globals())render = web.template.render('templates/', base=layout)class images:    def GET(self,name):        ext = name.split(.)[-1] # Gather extension        cType = {            png:images/png,            jpg:images/jpeg,            gif:images/gif,            ico:images/x-icon            }        if name in os.listdir('images'):  # Security            web.header(Content-Type, cType[ext]) # Set the Header            return open('images/%s'%name,rb).read() # Notice 'rb' for reading images        else:            raise web.notfound()class Index:    def GET(self):        form = web.input(name=Nobody, greet=None)        return render.upload_form()    def POST(self):        x = web.input(myfile={},name=Nobody, greet=Hello)        file_name = x['myfile'].filename # This is the filename        with open('/Users/mikekilmer/Envs/env1/images/' + file_name, 'wb') as saved:            shutil.copyfileobj(x['myfile'].file, saved) # save the file         greeting = %s, %s % (x.greet, x.name)        file_value = x['myfile'].value # This is the file contents        file_read = x['myfile'].file.read() # Or use a file(-like) object        return render.index(greeting = greeting, file_name = file_name,                            file_value = file_value, file_read = file_read)if __name__ == __main__:    app.run()The template:$def with (greeting, file_name, file_value, file_read)<div style=margin:300;>$if greeting:    I just wanted to say <em style=color: red; font-size: 1em;>$greeting</em>.    <br/>$else:    <em>Hello</em>, world!    <br/>$if file_name:    File name is <em style=color: red; font-size: 1em;>$file_name</em>.    <br/>$else:    <em>No file name</em>, friends!$if file_name:    File value is <em style=color: green; font-size: 1em;>$file_name</em>.    <br/>$else:    <em>No file value</em>, friends!       <br/>$if file_read:    File read is <em style=color: blue; font-size: 1em;>$file_name</em>.    <br/>$else:    <em>No file read</em>, friends!       <br/><img src=./images/$file_name/></div>The layout is as outlined in the book. Why do x['myfile'].filename, x['myfile'].value, and x['myfile'].file.read() (which I'm only sending out of curiosity) all seem to return nothing more than the file name (at least in the template)?
LPTHW Ex51 with image upload
python;beginner