request.files in flask completes the upload of the image and saves it

photo = request.files.get("image")

print(photo)
print(photo.filename)   ## 图片的名字
print(photo.headers)     ### 请求头部信息
print(photo.content_type)     ### 文件类型
print(photo.mimetype)     ###  内容类型
print(photo.mimetype_params)     ###  类型参数
photo.save(path)   ## 保存文件

Guess you like

Origin blog.csdn.net/Ghjkku/article/details/129252060