express-fileupload icon indicating copy to clipboard operation
express-fileupload copied to clipboard

Save temp file with file extension

Open toksdotdev opened this issue 4 years ago • 2 comments

I'm proposing that we save the temp file with the file extension, considering that in some cases, one might have a logic that depends on the file extension.

Currently, when a temp file is created, it strips out the file extension as shown here

Since we have the filename, we should be able to inject it into the getTempFilename(...).

I'll be very much open to creating a PR if you deem fit.

toksdotdev avatar May 29 '21 10:05 toksdotdev

Hi,

But the file object has a name property and in case you need an extension it is possible to get it from the original file name.

RomanBurunkov avatar Jul 30 '21 14:07 RomanBurunkov

I posted a workaround in stack overflow that

  1. gets the extension from the file object's "name"
    
  2. renames the temporary file to use the extension
    

But it will still be better for this to be the default behavior if useTempFiles: true and preserveExtension: true are used together.

picturedots avatar Jul 14 '23 01:07 picturedots