This seems to work: <form action="http://pb-dev.pricetack.com:8001/mobilepost/index3" enctype="multipart/form-data" method="post"> <input name="title" type="text" value="" /> <input name="price" type="text" value="" /> <input name="image" type="file" /> <input type="submit" value="Submit" /> <input name="_formname" type="hidden" value="no_table/create" /> </form>
def index3(): form = SQLFORM.factory( Field('title'), Field('price'), Field('image', 'upload', uploadfolder=request.folder+'static/uploads')) if form.accepts(request.vars): title = form.vars.title start_price = form.vars.price price_change = float(form.vars.price)*0.1 drops = 4 duration = 7 image = db.item.image.store(request.vars.image.file, request.vars.image.filename) db.item.insert(title=title, start_price=start_price, price_change=price_change, drops=drops, duration=duration, image=image) return 'ok' elif form.errors: response.flash = 'form has errors' return dict(form=form)