I have an uploaded file named:  CIY '06 001.jpg  (That's
CIY<space>'06<space>001.jpg)

I want to change the name of that file to:  CIY06001.jpg

By running a replace or regex.replace() or something to remove all
non-alphanumeric characters,

except the . before the extension.

 

I've tried a lot of different ways to rename the file, including:

 

<cfset renamedOriginal = #replace(cffile.serverFile, "[^a-zA-Z0-9.]", "",
"all")#>

<cfset renamedOriginal = #replace(cffile.serverFile, "[^a-zA-Z0-9\.]", "",
"all")#>

 

<cfset renamedOriginal = #regex.replace(cffile.serverFile, "[^a-zA-Z0-9.]",
"")#>

<cfset renamedOriginal = regex.replace(cffile.serverFile, "[^a-zA-Z0-9.]",
"")>

 

etc., etc., ad nauseam.

 

Either the filename is not changed or an error is throw because regex isn't
understood.

 

Is there a <cfscript> way of doing this with regex.or another solution?

 

How can I make this work?

 

Thanks for any feedback!

 

Rick

 

----------------------------------------------------------------------------
------------------------------------------------------

"It is my experience that most bad government is the result of too much
government." - Thomas Jefferson

 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320514
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to