We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

CFFile in CF8: Filename is being changed

djrubin
djrubin asked
on
Medium Priority
355 Views
Last Modified: 2012-05-11
Trying to upload a file to our server with the following code. Each and every file we upload gets a filename of "upload_filesX" where X is a sequential number. Why is the original filename coming across in the form submit not "sticking"?
<cfif structKeyExists(form,"AddPictureImage") and len(trim(form.AddPictureImage))>

<!--- Use the cffile tag to upload the image file. --->
<cffile action="UPLOAD" filefield="AddPictureImage" destination="#upload_dir#" nameconflict="MAKEUNIQUE">
<cfoutput>#cffile.serverfile#</cfoutput><cfabort>

Open in new window

Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2015

Commented:
Because you're using:  nameconflict="MAKEUNIQUE">  That instructs CF to generate a unique name for the file if that file already exists.  If you want to overwrite the existing file, use nameconflict="overwrite"

Author

Commented:
But the file I'm trying to upload is not on the server. If "MakeUnique" only changes the filename IF there is a conflict, then nothing should be done.
CERTIFIED EXPERT
Most Valuable Expert 2015
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Thanks... a slightly different twist to your debug suggestion does indicate that CF thinks I have that file already... trouble is I don't so I'll dive in on why it thinks I have the file.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.