I am wondering if it would be a bad idea to create a folder for every user. So any images for each user would be accessed with img.mysite.com/UserId/image.jpg
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This could grow to be a huge number of directories, so take caution as some filesystems limit the number of subdirectories in a single directory. It is common to break up generated content into multiple directories. You could do it by date, or break up some identifier (a hash, or the image’s autoincremented ID number) to create a deeper directory structure. Example:
AKA the directory prefix is
floor(ID / 1000).There’s probably a case for abstracting your URIs from your filesystem anyway, so it doesn’t really matter where the files are stored on the backend, except to you as a programmer.