Page 1 of 1

Need Quick Advice - File Organization Method

Posted: Wed Jul 21, 2010 10:22 am
by JonathanStanton
Hey I need feedback:

General Idea: I want a user to be able to upload a bunch of images that connect with a specific database entry.
Question: Is putting variables in the file name the best way to find them dynamically again in the future?

Example:
[text]Filename: _uniqueID_isThumb_isPrimary_Filename.EXT[/text]
So if my user uploaded 15 photos one of the photos they could be named:
[text]123_no_yes_MyPhoto.jpg or 289_yes_no_OtherPhoto.png[/text]
Where the first number is the database unique id, then it's asking is it a thumbnail, then is it the Primary Image.

Summary: So... Is putting variables in the file name the best way to find them dynamically again in the future?

Re: Need Quick Advice - File Organization Method

Posted: Wed Jul 21, 2010 10:30 am
by eruna
It would be better to have a table that records the images.

In other words

Data table:
ID | TITLE
------------------
1 | Doc title

Photo table:
photo_name | data_id
------------------------------
123.jpg | 1
124.jpg | 1

Then you can make a simple database call to get the images.

E