【发布时间】:2010-10-13 00:33:09
【问题描述】:
我想创建一个简单的文件上传表单,我必须完全无能为力。我已阅读文档和教程,但由于某种原因,我没有收到提交的表单数据。我写了我能测试的最少量的代码,但它仍然无法正常工作。有什么想法吗?
def index():
html = '''
<html>
<body>
<form id="fileUpload" action="./result" method="post">
<input type="file" id="file"/>
<input type="submit" value="Upload"/>
</form>
</body>
</html>
'''
return html
def result(req):
try: tmpfile = req.form['file']
except:
return "no file!"
【问题讨论】:
-
你在使用 web2py 框架吗?
-
“不工作”是什么意思?你有错误跟踪吗?另外,你为什么不使用 mod_wsgi?
-
@S.Lott “我没有收到提交的表单数据。”我不知道 wsgi。
-
@scotty2012:“没有得到”——这是什么意思?追溯?安静? 404错误? 500错误?请参阅code.google.com/p/modwsgi 以获得比 mod_python 更好的界面。
标签: python upload mod-python