samedi 10 janvier 2015

S3 image urls in database


I have an application where users will be able to upload multiple images for one Product. I'm planning on using jQuery File Upload, and Amazon S3.


The thing I'm confused about, is how people usually associate many images with a single model.


For example, if for every Product, there can be many Images, how do I store the images to be associated with the Product?


I was thinking of having jQuery File Upload return the s3 url for each image. So if 10 images were uploaded, then 10 hidden fields were created for each image-url, which I then JSON serialize and store in the Product model?


But this doesn't seem like a pretty solution? What's a better method?





Aucun commentaire:

Enregistrer un commentaire