joshuaadickerson / Elkarte2

Elkarte Version 2
Other
0 stars 0 forks source link

Uncomplicate the attachment directories #15

Open joshuaadickerson opened 8 years ago

joshuaadickerson commented 8 years ago

Instead of trying to complicate things with attachments, just make it one simple setting.

Allow the admin to select the number of levels that the attachment directories will be. Start with 0 meaning every file is stored in 1 directory. At 1 it will select the first character of the base64 encoded hash and place the files in that directory. At two, it will break down each parent directory in to their own directories based on the second character. It will do that until you reach the end of the hash. You will never have more than 64 directories in a directory. If you don't want to have more than 1000 files in a directory, at level 1 you'd have up to 64k files without issue. No extra directory id variable. You can do it at any time and still find the files. The files would be organized in a manner which makes them easy to find.

One caveat is that base64encode($hash) may result in having "/" as a character. So, just replace / with