Loading...
 
Features / Usability

Features / Usability


Re: Wiki attachments require unique filenames

posts: 13 United States

> If I upload a file attachment to a wiki page, and then go to another wiki page and upload a file of the same name, then the first file will get replaced by the contents of the second without warning.
>
> So there is a uniqueness requirement to filenames for wiki uploads across the site.
>
> This is apparently only an issue if I use Admin->Wiki Attachments->Use a directory to store files. I'd very much like to keep using filesystem storage over database storage.
>
> I haven't found where exactly it does it in the source, but it would seem the files get stored onto disk in the designated wiki file directory according to the md5 hash of the filename. So a second file of the same name will have the same hash and overwrite any pre-existing one. Can the md5 hash be changed so it's a concatenation of the ))WikiPageNamewith theFileName((? Then there would only be a naming uniqueness requirement per-wiki page?

Looks like file galleries (tiki-upload_file.php) avoids this problem by using uniqid(filename) to generate the md5 name to store on disk. Some small patches to tiki-index.php and tiki-admin_include_wikiatt.php seem to be all that's needed. (Attached diff run through patch)

--Art

There are no comments at this time.