geroid Posted May 20, 2009 Share Posted May 20, 2009 Hi I'm just looking for some advice on uploading images before I start the work. I'm doing a website for some people. They will get to upload information about events that they run to a database. They would also like to upload images relating to these events. I have a form which allows them to upload the event info into the database and this dynamically appears on the webpage. My query is: 1. How do I associate the images that they upload with a particular record? 2. Could I, for example, save the event record and then save the image path in a seperate table with the event record id so as to link and retreive them Do you think this is the best way to do this. Also what do I do to allow them to upload any number of images and relate them to a single event record. As I say it's just a query at the moment. I don't want to waste time going down the wrong path Thanks for any advice Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/ Share on other sites More sharing options...
pdkv2 Posted May 20, 2009 Share Posted May 20, 2009 you can use the event record id as a file name if it is unique this way you can generate the file name on the fly when you fetch the record from the DB and use it on the page. Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/#findComment-838030 Share on other sites More sharing options...
trq Posted May 20, 2009 Share Posted May 20, 2009 Quote Could I, for example, save the event record and then save the image path in a seperate table with the event record id so as to link and retreive them Yes. Thats answers your first question. Quote Do you think this is the best way to do this. Yes. Quote Also what do I do to allow them to upload any number of images and relate them to a single event record. Just add more paths to your image table, using the same article id to relate them. Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/#findComment-838032 Share on other sites More sharing options...
geroid Posted May 20, 2009 Author Share Posted May 20, 2009 Thanks for that. Just in relation to Thorps last answer. Would each image path be stored as a seperate record in the table with the same event id and a different image name? Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/#findComment-838048 Share on other sites More sharing options...
trq Posted May 20, 2009 Share Posted May 20, 2009 Quote Thanks for that. Just in relation to Thorps last answer. Would each image path be stored as a seperate record in the table with the same event id and a different image name? Yep. Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/#findComment-838051 Share on other sites More sharing options...
geroid Posted May 20, 2009 Author Share Posted May 20, 2009 Ok it's beginning to come together. I guess I'll have lots of questions when I begin but one that comes to mind now is this. If I allow them to upload any number of images per event record - so one event might have one image associated with it, another might have 2, another 3 or even none. How might I plan to design my webpage to accomodate this? If there are no images for an event I don't want a big blank square on the page etc. How will I detect the number of images and dynamically display them on the webpage. Just a query for now though. Link to comment https://forums.phpfreaks.com/topic/158903-how-to-associate-image-upload-with-other-data/#findComment-838074 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.