CodeIgniter Forums
Class File - method getRandomName - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: Class File - method getRandomName (/thread-74832.html)



Class File - method getRandomName - abatrans - 11-13-2019

A quick suggestion to add flexibility to the getRandomName function.

Add 2 parameters:
  1. useTime - Boolean to indicate if the time value should be included as part of the generated file name - default TRUE
  2. stringLength - Integer to set the length of the random bytes - default 10
The function, in its current form is generating a filename of 31 characters plus however long the extention is.  These extremely long filenames are resulting in display issues when having to display the file name.

By allowing the developer to set their own parameter as to how the random file name should be generated will imho make the function even better.