Use FileExists to determine if the filename already exists. If it
doesn't, keep the original name, if it does, create a new file name with
a UUID.

Pascal

> -----Original Message-----
> From: Anders Green [mailto:[EMAIL PROTECTED]
> Sent: 29 October 2004 04:28
> To: CF-Talk
> Subject: CFFILE copy, but with "MakeUnique" like upload?
> 
> Ok... so, I have some pictures. They are uploaded by
> users. CFFILE action="upload" has a very handy way
> of making sure they never overwrite any other files
> with the same name. The name of the file is in the
> database. (Let the webserver do all the work of cacheing)
> 
> Now, I clone the database record. I want to copy
> the image file to a new, unique name, (and update the
> new database record, of course) so that when editing
> is done on the new record, like deleting the image (which
> removes both the filename in the db _and_ the actual file)
> it doesn't mess up the original record, which would
> still be referencing the original image file.
> 
> If the CFFILE action="copy" had the nameConflict=makeUnique
> like upload does, it would be very easy. But it doesn't.
> 
> I guess I could make a UUID and stick a ".jpg" on the
> end of it, but keeping the original base file name would
> be nicer.
> 
> Thoughts?
> 
> Anders
> +===========================================================+
> |Anders Green                 Email: [EMAIL PROTECTED]       |
> |                              Home: 919.303.0218           |
> |        Off Road Rally Racing Team: http://linaracing.com/ |
> +===========================================================+
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Protect your mail server with built in anti-virus protection. It's not only good for 
you, it's good for everybody.
http://www.houseoffusion.com/banners/view.cfm?bannerid=39

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:182907
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to