0

I am working on a site and one of its requirement is to add multiple images to a single column of database along with other details.

This is the screenshot of my webform:

enter image description here

and this is my database table:

enter image description here

But I am confused about adding multiple images in a specific field of one row. Is it possible that a single record can have a field with multiple images stored in it? Please suggest a good solution to this problem.

Thank you

3
  • 1
    Create a different table call Images, have a link from this table to that one (the Images column became foreign key to that table). Commented Jan 1, 2017 at 14:03
  • 2
    The only good solution would be to add a new table for the images, that will contain a foreign key to this table, and a varbinary(max) column to store a single image. Anything other then that will cause problems. Commented Jan 1, 2017 at 14:03
  • Yes I know, I can do it this way. Thank you.. I think I have to do it this way only. Commented Jan 1, 2017 at 14:11

1 Answer 1

1

You can store multiple files together in a single blob or stream by using MIME Multipart formatting. See this RFC: https://www.w3.org/Protocols/rfc1341/7_2_Multipart.html

Note that using a separate table with one record per image/file is a better overall solution because there is a large overhead in extracting files from a Multipart blob, making it slow and inefficient... so don't store files larger than a few kilobytes.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.