from bottle import run, request, route

@route("/upload", method="POST")
def upload():
    file = request.files.get("file")
    file.save(".", overwrite=True)

@route("/")
def index():
    return """<html>
<head>
    <title>upload</title>
</head>
<body>
    <form action="upload" method="POST" enctype="multipart/form-data">
        <input type="file" name="file" />
        <input type="submit" value="upload" />
    </form>
</body>
</html>"""


run()

标签: none

添加新评论