OSTicket 1.6: Allow 2 to 5 digit file extensions (or more)

File extensions on OSTicket 1.6 ST are limited to 3 - 4 digits in the stock distribution. But some times you want to change this to allow for slightly longer or slightly smaller file extensions. Such as .gz or .xhtml.

Edit [document root]/include/class.config.php

circa line X locate the following:

$ext = strtolower(preg_replace("/.*\.(.{3,4})$/", "$1", $filename));

and change it to

$ext = strtolower(preg_replace("/.*\.(.{2,5})$/", "$1", $filename));

This will allow file extensions as small as 2 character and as large as 5.

Alternatively if you dont care how many characters are in the extentsion you could do

$ext = strtolower(preg_replace("/.*\.(.+)$/", "$1", $filename));

Which would allow any extension greater than 0 character.