Child pages
  • Alternative to automatic renaming of uploaded files
Skip to end of metadata
Go to start of metadata

Right now if a user uploads a file, then we keep filename as-is. Only in case if there is already file with identical name in that folder, then we add _1, _2, _3 and so on. Knowing fact, that users don't really care about naming their files we might end up with images named like this IMG_44455.jpg, IMG_44456.jpg and so on (e.g. from Canon camera upload). This way anybody can scan download all uploaded files from a folder even without being able to get actual file list from it.

We already have a system, that would allow to place uploaded files into sub-folders based on their name or upload date. This solves a problem, when you need to manually look into folder, where uploads are made and is unable to do so, because of having thousands of files in a single folder.

To finalize I'm proposing to automatically rename whatever files we upload using following formula: MD5(Filename + UploadTime). In case that name is already taken, then we add _1, _2, ... and repeat MD5 process. This way there won't be even closely similarly named files in same folder.

I'm not sure however if we should enable this mode by default or give an ability to use old file naming system at all. No matter what the choice, but already uploaded files won't be affected.

Example filename: d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f89.jpg

Related Tasks