allow specifying a file extension for getTempFile


GetTempFile always creates a file with a .tmp extension, but this is problematic for image functions
as the image file type is determined by the destination file extension.

It would be really nice to support a third parameter which allows the user to specify which file extension the temp file should have, default is of course "tmp"


Pothys - MitrahSoft
June 26, 2019, 2:07 PM

I've added the feature for this ticket to create a temp file with various extensions .
The allowed extensions are txt,doc,docx,pdf,zip,img,png,tmp,jpeg,jpg.
will decide about this changes.

Pull request:

Zac Spitzer
June 26, 2019, 2:19 PM

Shouldn't that list of allowed file types reuse the allowed upload types as per that recent cve, i.e this.blockedExtForFileUpload as per LDEV-2174?

Zac Spitzer
September 7, 2019, 12:37 PM

can this be added to the next sprint, I'm always writing extra code to deal with this as other functions in Lucee rely on the file's extension

Zac Spitzer
October 14, 2020, 1:21 AM

can we have ext as an alias for extension ?

what do you think of making dir default to getTempDirectory()when used with named parameters?

I’m always writing (when this gets merged)


Michael Offner


Zac Spitzer


Affects versions