Search code examples
coldfusioncoldfusion-9

Using CF 9 Script how do I upload a file and rename at the same time?


Using CF 9 Script how do I upload a file and rename at the same time?

Below is an examples of what I have so far it works but I cannot get the file extension for the image upload dynamically.

local.results=fileUpload("D:\wwwroot\imageStore\#local.hash#.#cffile.serverFileExt#","image","","makeUnique");

cffile.serverFileExt = error


Solution

  • The serverFileExt value isn't available until after the upload completes. You would need to upload the file and then get the server file extension from the results structure.