flask实现文件的上传
@app.route("/filetranslate", methods=['POST']) def filetranslate(): files = request.files["files"] print(files, 12901) print(files.filename) file = "static/files/" + files.filename print(file) files.save(file) url = urls + '/filetranslate' param = {'files': open(file, 'rb')} rst = requests.post(url, files=param).content try: res = json.loads(rst) except Exception as e: res = { 'code': -1, 'message': e } return res