why like this? why not use the NAMECONFLICT attribute of CFFILE? it will automatically remane the uploaded file by appending a sequential number to it. you can then on your 'success' page show user a link to the created file, and/or email it to the user if you want to... why not allow a user to upload a file only because someone before has uploaded a file with same name?
--- Azadi Saryev Sabai-dee.com http://www.sabai-dee.com Rick Sanders wrote: > Hi Rick, > > It doesn't solve the problem though. Here's the problem: > > 1. User #1 uploads a file called "Movie.wmv". The file is uploaded to > site/videos/Movie.wmv. The file is referenced in the database in the video > file field " Movie.wmv ". > 2. User #55 also uploads a file called "Movie.wmv" which is a totally > different video in a totally different category. But, because it's named the > same, it overwrites the original "Movie.wmv" file, thus making both videos > the same. > > I need to check to see if the file exists before it's uploaded, or it'll > overwrite the existing video. > > My work-around is to upload the file to a temp location then check if the > file exists already. If not, move the file to the videos folder. If it does > exists, delete it from temp and return an error. > > Kind regards, > > Rick > > -----Original Message----- > From: Rick Faircloth [mailto:[EMAIL PROTECTED] > Sent: February-05-08 11:28 AM > To: CF-Talk > Subject: RE: File upload > > Why not have the user upload the file, rename it automatically if there is > a conflict for a name that is referred to within the database, but also > retain > the original filename in the database for display to users. > > Rick > > >> -----Original Message----- >> From: Todd Rafferty [mailto:[EMAIL PROTECTED] >> Sent: Tuesday, February 05, 2008 9:27 AM >> To: CF-Talk >> Subject: Re: File upload >> >> You're still going to run into an "valid" issue where two completely >> different videos have the same name. When it comes to CMS, even if >> > they're > >> dupes, they're valid. The client is responsible for weeding out the >> duplicates. Just getting the name (in your instance), wouldn't do you any >> good. It's almost like you'd also want the MD5 checksum of the file as >> > well > >> or something else. There really is no way to determine if it's a >> > duplicate > >> or not until it's on the server. The name alone is not enough to go on. >> >> On Feb 5, 2008 9:17 AM, Rick Sanders <[EMAIL PROTECTED]> wrote: >> >> >>> Hello James, >>> >>> I want to grab the file name and query it in the database to see if it >>> exists or not before the 15mb file is uploaded. This way, if the file >>> exists, I can easily return an error and prompt the user to rename the >>> file, >>> or offer suggested names for the file. >>> >>> I've created a site for uploading videos, and there is a chance that 2 >>> people can upload a video with the same name, but the video is >>> > completely > >>> different. If I could bypass the upload and just check the name then >>> > this > >>> would save alot of time. >>> >>> Kind regards, >>> Rick >>> >>> >> >> > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;160198600;22374440;w Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:298211 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

