Answer the question
In order to leave comments, you need to log in
How to upload images to database in flask?
I am using SQLAlchemy. I can’t figure it out, for example, in django, the corresponding field indicates the folder to save
img = models.ImageField(upload_to=user_directory_path, verbose_name='Ваше фото')
class Image(db.Model):
__tablename__ = 'images'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String())
img_filename = db.Column(db.String())
img_count = db.Column(db.Integer)
creation_date = db.Column(db.TIMESTAMP, server_default=db.func.current_timestamp(), nullable=False)
def __repr__(self):
return '<image id={},name={}>'.format(self.id, self.name)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question