There's all kinds of stuff available when you upload a file. 

cffile.serverFileExt will hold the extension

Dump #cffile# for the rest

#listlast(filename, ".")# will get you the extension too ;-)

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com


-----Original Message-----
From: Les Mizzell [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 23, 2007 10:50 PM
To: CF-Talk
Subject: Renaming Files with CFFILE

It's so difficult accounting for every single "Stupid User Trick" that 
you often just want to run screaming off into the sunset at times. 
Regardless of what safeguards (client *and* server side validation, 
cfquery param, blah...blah....) you put in place, somebody comes up with 
*something* that mucks up the works and refuses to "do it right" and 
your client says "YEs, that's stupid, but figure out how to deal with 
that!".

Now that I've got that off my chest...

I'm dealing with a CFFILE field. It accepts text, .doc, and .xls files. 
I do *not* want to accept the original file names, because folks are 
pretty much idiots and will name a file anything.

Here's one somebody tried to enter as a test today:

"Insurance Enroll. Info for Germany Partnership for Jason & Tommy..xls"

Yup, that whole line of text is an actual file name.

OK, I want to rename this with the record ID that goes into the 
database, so "397564.xls" looks great to me instead of the above.
Got no problem with the record ID part - how do I extract the correct 
file extension to tag onto the renamed file, since it can vary, and 
since it can look like something really stupid like the above .xls file?





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
ColdFusion MX7 by AdobeĀ®
Dyncamically transform webcontent into Adobe PDF with new ColdFusion MX7. 
Free Trial. http://www.adobe.com/products/coldfusion?sdid=RVJV

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:279049
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to