【发布时间】:2011-02-22 06:07:10
【问题描述】:
我创建了一个测试表单,要求用户输入名称并上传图像文件:
<html lang="en">
<head>
<title>Testing image upload</title>
</head>
<body>
<form action="/services/upload" method="POST" enctype="multipart/form-data">
File Description: <input name='fdesc' type='text'><br>
File name: <input type="file" name="fname"><br>
<div><input type="submit"></div>
</form>
</body>
</html>
我需要获取用户上传的文件并将其存储在我的本地 PC 上。这可以在 python 中完成吗?请告诉我。
【问题讨论】:
-
抱歉出现错误,我的本地 PC 是指我们的开发服务器本身,上面提到的 html 文件已加载到该服务器上。是否可以获取文件并将其存储在 /tmp 或其他位置。
-
你是如何使用 Python 的? mod_python、mod_wsgi、CGI 脚本还是别的什么?
-
它和 apache 服务器,我正在使用 mod_python
-
你能接受答案吗?谢谢
标签: python file upload file-upload