I got tired of people uploading huge uncompressed file attachments. So, I added code to TWiki to allow a person to limit the types of files that get uploaded. I have not made a provision for a filetype of "any", but it wouldn't be hard.
In
TWikiPreferences (or perhaps
WebPreferences) you set the following:
- List of filetypes users are allowed to upload:
- Set WIKIALLOWEDFILETYPES = .gif, .jpg, .png, .zip, .tar.gz, .tgz
I made changes to the upload script by adding the
checkValidFileType function. I also changed the
attch.tmpl and added the
oopsuploadtype.tmpl
I have attached the files to this topic.
--
JaredRobinson - 20 Jan 2001
This looks very useful and IMO should be a core feature - someone tried to upload 50+ MB video files as attachments to my company's TWiki, and it used up all the disk space. However, it doesn't stop someone uploading an approved file type such as .zip that is much larger than the available space, so:
- It may be best to have the attachments directory on a separate filesystem, otherwise very large attachments may result in text of a page getting lost (should be in TWiki docs).
- It would be great if TWiki could also just refuse new attachments once the attachments filesystem has reached a certain level of fullness (e.g. 80%), and perhaps email the TWiki administrator to warn them this has happened. Could be part of the attachments code. Being able to set the maximum size allowed per individual file would round out this feature. -- MikeMannix - 29 Sep 2001
--
RichardDonkin - 29 Sep 2001