Welcome to WebmasterWorld Guest from

Forum Moderators: bakedjake

Message Too Old, No Replies

Advice on image uploading



3:57 pm on Oct 5, 2007 (gmt 0)

5+ Year Member

I'm building a site which will allow users to upload images (CentOS/Apache/MySQL/PHP). The user will select an image to upload from their local machine then see a preview of the image and be prompted to select an area of the image for a thumbnail. Then both the full size and thumbnailed images will be saved to the server with a randomly generated 32 character filename (saved into mysql).

My testing site has all of the images being dumped into /image/uploads for full size images, and /image/uploads/thumbs for the thumbnails. After uploading quite a few test images I realized that I might have a scalability problem.

My initial thoughts on a better directory structure are this:

Is this a solid solution or is there a better idea? Should I just continue to let them pile up in a single directory. Any advice would be appreciated.


4:05 pm on Oct 5, 2007 (gmt 0)

10+ Year Member

I would segment by the filename..

For example, with a ten character filename 123456790.gif


I definitely wouldn't keep throwing them in one directory though :)


11:19 pm on Oct 5, 2007 (gmt 0)

5+ Year Member

Thanks. That seems logical enough and probably easier to manage. With a 32 character file name, how many levels deep should I take it though?

[edited by: SixTimesEight at 11:35 pm (utc) on Oct. 5, 2007]


1:36 pm on Oct 8, 2007 (gmt 0)

10+ Year Member

It really depends on the number of files you're anticipating, but two levels should be more than enough.