Possible Duplicate:
Thousands of images, how should I organize the directory structure? (linux)
i'm building a custom e-commerce, and one of it's functionalityes is to store user files on the web.
I read that storing files on DataBase sucks, and the right is to put only the path to the file.
But, what's the best way of storing those files? I mean, i can't just upload the file, and save them as they are...
- I tought in something like this:
- I will start with a folder called 0001, and before copying the file to the folder, i will check: "is the folder with the maximum size i want?", if yes, then it will create a new folder (0002) {and i don't know how is the best way, to before uploading, knowing what's the biggest folder}.
- After uploading, the name that i will set, will be based on 2 things:
- The hashed id of the user (with a random security) with a underline _
- Plus, a random hash of the size with a underline _
- Plus a random hash, based on a random number
- Plus the same file extension (IS THIS RIGHT? if, the user upload a .php file, will it !@#! my server?)
Is it good enough? Or did i forgot something?
I have never worked with lots of file uploads, that require to be restricted ("not sequencial"), and i would apreciate any tips!
Thanks