📜  flask rest api 上传图片 - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:29.032000             🧑  作者: Mango

代码示例1
from flask import Flask
    from flask_restful import Resource, Api, reqparse
    import werkzeug

    class UploadAudio(Resource):
      def post(self):
        parse = reqparse.RequestParser()
        parse.add_argument('file', type=werkzeug.datastructures.FileStorage, location='files')
        args = parse.parse_args()
        audioFile = args['file']
        audioFile.save("your_file_name.jpg")