Just a little something I use for an email application.  It removes spaces
in the attachment names.

<!--- ...save the file to the server... --->
 <CFFILE ACTION="UPLOAD"
  FILEFIELD="AttachFile"
  DESTINATION="#AttachDir#"
  NAMECONFLICT="OVERWRITE">

 <!---  clean any spaces and rename the file.  Will retain original
 name without the space.  Can replace the space with an underscore
 also.  <cfset cleanfilename = replacenocase(#filename#," ","_","ALL")> --->
  <CFSET FILENAME = #FILE.SERVERFILE#>
 <CFSET DIRECTORY = #AttachDir#>
 <CFSET CLEANFILENAME = REPLACENOCASE(#FILENAME#," ","","ALL")>
  <CFFILE ACTION="Rename"
   SOURCE="#directory##filename#"
   DESTINATION="#directory##cleanfilename#">



Yvette Ingram
Brainbench Certified ColdFusion 4.5 Programmer
Email: ingramrecruiting@erols or
[EMAIL PROTECTED]
ICQ:  21200397


----- Original Message -----
From: "Peter Benoit" <[EMAIL PROTECTED]>
To: "CF-Talk" <[EMAIL PROTECTED]>
Sent: Monday, February 19, 2001 2:56 PM
Subject: RE: CFFILE & spaces


> Is there anyway to change this?  The file is supposed to not have
> underscores in it, so it won't match what's in the DB.
>
> -----Original Message-----
> From: Chad Gray [mailto:[EMAIL PROTECTED]]
> Sent: Monday, February 19, 2001 2:21 PM
> To: CF-Talk
> Subject: Re: CFFILE & spaces
>
>
> CFFile puts underscores in the name where spaces are.
>
> I believe CFFile bases it's overwrite decision off the #file.serverfile#
> variable.
>
>
> At 01:14 PM 2/19/01 -0500, you wrote:
> >What does CFFILE do with a file which has spaces in the name?
> >
> >I would like make an upload form for documents, but some may be named "My
> >document edition one.doc" or such.  Will the spaces be left?  What about
> >file name conflicts?  Will the spaces interfere with this?
> >
> >TIA,
> >Peter
> >
> >
> >
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to