I'm trying to get multiple files with web.py. The form is something like
this:
<form method="POST" action="/addProduct" enctype="mutipart/form-data">
<input type="text" name="name">
<input type="text" name="address">
<textarea form="pro-form" name="des"></textarea>
<input type="file" name="icon">
<input type="file" id="uploadSc" name="screen">
<input type="submit" value="submit"></form>
Python code is as follows:
class addProduct(Auth):
def GET(self):
return render.addProduct()
def POST(self):
i = web.input(icon={}, screen={})
name, address, des, icon, screen = i.name, i.address, i.des, i.icon,
i.screen
# print icon.filename
print icon
icon_dir = './static/product/icon/'
# icon_dir = saveFile(icon, icon_dir)
screen_dir = './static/product/screen/'
# screen_dir = saveFile(screen, screen_dir)
db.insert(product, pro_name=name, pro_url=address,
pro_screenurl=screen_dir, pro_iconurl=icon_dir, pro_desc=des)
return icon
The server simply returns just the filename of the icon, not the value of
it:(
--
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.
For more options, visit https://groups.google.com/d/optout.