Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cffile and makeunique

Status
Not open for further replies.

kjeff215

MIS
Mar 19, 2002
17
US
I am having a problem with the makeunique function within the cffile. When I upload to a temp file, it is not appending a unique value to the file. I then move it to permanent. The problem is that when someone deletes a file that someone else has also contributed, the file is now gone from both contributions since there is only one instance of the file. How do i get this "makeunique" to work or is there a better solution.

I need some guidance and sample code if possible
thanks
 
FIRST:
MAKEUNIQUE does not append unique value, it changes the entire file name, keeping the same extension.

SECOND:
If you are uploading to a temp folder, MAKEUNIQUE will not do anything unless a file with the same name exists in the temp folder.

THIRD:
Are you moving them by hand or by <cfmove>?? If you use <CFMOVE> you can specify a new file name in the destination path.

FOURTH:
If you use MAKEUNIQUE, you can use the #cffile.param# to get the uploaded file information

<cffile action = &quot;upload&quot;
fileField = &quot;formfield&quot;
destination = &quot;c:\path\&quot;
nameconflict = &quot;MakeUnique&quot;>

#cffile.serverFile# is the name of the file you just uploaded.

params are as follows:
attemptedserverfile
clientdirectory
clientfile
clientfileext
clientfilename
contentsubtype
contenttype
datelastaccessed
fileexisted
filesize
filewasappended
filewasoverwritten
filewasrenamed
filewasoverrenamed
filewassaved
oldfilesaved
serverdirectory
serverfile
serverfileext
serverfilename
timecreated
timelastmodified

I STRINGLY SUGGEST THAT EVERYONE THAT EVEN THINKS ABOUT USING CF GOES TO MACROMEDIA.COM AND DOWNLOAD THE CFML REFERENCE. IT IS FREE AND WILL ANSWER MOST OF YOUR QUESTIONS FOR YOU.
 
sorry, you don't need to use makeunique to use the cffile.params. I kind of made it sound that way. you cna use the cffile.paramms no matter how you use <cffile action=&quot;upload&quot;>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top