Hello,
As part of the "learning experience"; I realize that my current setup is probably not ideal. I have been storing members' images in a folder called "pics" and I point to them in mysql. Right now they all are in the same folder and there are over a few thousand of them. At this point I can't even browse to all of the files using FTP because it must be beyond some limit. I'm hoping to hear some advice on a few things here:
How many files is "too many" to have in a directory?
Currently when a member creates a profile their image is named as their memberid#; such as 1234.jpg. If I go with subfolders, how will I seperate? Per thousand? Per 100? Assuming it's per 100; how would I design the script so that when the 400th member creates a profile it builds a new folder and names it 400 or whatever?
Can anybody please show me an example of what a script would look like to deal with all of the files currently on the folder? Again, assuming that 100 is a good number to use, and the image path is stored simply as the memberid + extension; how would I do something like:
$new_dir=100;
Create folder called $new_dir in pics dir
Select memberid, image FROM table where memberid < 100
WHILE...
move $image to pics/100;
UPDATE table SET image=$newdir/$image
..?
Very sorry for so many questions but I'm a little nervous about this one and would appreciate any advice.
Thanks