我正在尝试使用flask将图像上传到本地服务器上,并且成功完成了,但是我想要该上传图像的元数据,例如图像的名称,大小,日期和时间。这是我的代码:
photos = UploadSet('photos', IMAGES)
app.config['UPLOADED_PHOTOS_DEST'] = 'static/img'
configure_uploads(app, photos)
@app.route('/upload', methods=['GET', 'POST'])
def upload():
if request.method == 'POST' and 'photo' in request.files:
img_file = photos.save(request.files['photo'])
imageType = photos.save(img_file.content_type) # this is not
working.
return img_file
return render_template('upload.html')
if __name__ == '__main__':
app.debug=True
app.run(host='0.0.0.0',port=5000)
如何获取图像的元数据。