Aug 8, 2018

The file gets stored in a tmp folder before it is moved to its intended location. I know a lot of people that wanted to run validations on the file before this happens. Writing a cfdump of the form post will reveal the file but it will look like this :
"/opt/coldfusion10/cfusion/runtime/work/Catalina/localhost/tmp/neotmp5631239908297545419.tmp".

The original file name is not included in the form post, one of the workarounds I have seen was to use Javascript to populate a hidden input field with the file name, this hidden field would then be included in the form structure. We know that Coldfusion knows the file name as it uses it to rename the tmp file to the file name once the file is moved to its intended location.

I did find that the file name is included in the form post but it is not obvious on how to get to it.

/* BEGIN - get uploaded image file name */

uploadedFileName="";

getPartsArray=form.getPartsArray();

arrayIndex=arrayFind(getPartsArray,

function(s)

{if(left(s, 38) =="com.oreilly.servlet.multipart.FilePart" )

returntrue; returnfalse;});

if ( arrayIndexGT0 ) {

uploadedFileName=getPartsArray[arrayIndex].getFileName();

}

/* END - get uploaded image file name */

I found the array being returned was not always consistent, hence the need to search through the array for the desired object. There probably is a better way to access this, and I will look into that when I have more time.

Visit Me

Subscribe To

About Me

Cold Fusion Web Developer with 9 years experience in the health-care industry currently living in Houston, TX. I love the challenge of creating web applications that have a greater focus on the end user experience, including meeting Section 508 accessibility standards. I also have a great passion for technology, from just toys to tools to make life easier.