依赖环境:python3 依赖包:flask,pyOpenSSL(pip install flask pyOpenSSL) #coding=utf-8 import os from flask import Flask, redirect, url_for, request, render_template, send_from_directory import time app = Flask(__name__) BASE_PAT
依赖环境:python3
依赖包:flask,pyOpenSSL(pip install flask pyOpenSSL)
#coding=utf-8import os
from flask import Flask, redirect, url_for, request, render_template, send_from_directory
import time
app = Flask(__name__)
BASE_PATH = '/tmp/tmp_file/'
@app.route("/upload",methods=["POST"])
def upload_file():
try:
f=request.files["file"]
filename = os.path.join(BASE_PATH,"",f.filename)
f.save(filename)
print("{0} file upload succcessfully!".format(filename))
time.sleep(1)
return "file upload successfully!"
except Exception as e:
return e
if __name__ == '__main__':
app.run(host="0.0.0.0",port="5555",debug=False,ssl_context="adhoc")