-2

Hi everyone and thanks in advance, I wanted to ask how I can insert images in a sql table. I have to use flask for websites. Thank you

teio
  • 11
  • 1
  • 1
    you don't store images in a database. Use a folder and save the files there. What functionnality do you want to implement, what service does your server may offer ? – azro Jan 11 '22 at 21:41
  • [Storing Images in DB - Yea or Nay?](https://stackoverflow.com/q/3748/3890632) – khelwood Jan 11 '22 at 21:42

1 Answers1

0

I think the best way is to not store the image directly in the database. Rather it would be better to have the file path for the image in the database. If the image is external, then a link to the image. Database storage is more expensive than having the image in a filesystem. In addition, you don't need any special type of code to access images in filesystems.

Credit, and for further help: Storing Images in DB - Yea or Nay?

IPSDSILVA
  • 1,667
  • 9
  • 27
  • hi, thank you very much, could you tell me how you would do it specifically since i don't have much experience with sql? Thanks again – teio Jan 12 '22 at 16:30
  • Hi, I'm not completely good with this type of setup, especially with `Flask`. You can probably look up `how to send images to server using Flask` and then figure out how to use that image to store into `file path`. – IPSDSILVA Jan 13 '22 at 01:01