Skip to main content
Participant
September 14, 2011
Question

cffile rename: what happens if the destination name already exists

  • September 14, 2011
  • 2 replies
  • 458 views

coldfusion 9 enterprise: can one use nameconflict?

    This topic has been closed for replies.

    2 replies

    Participant
    September 15, 2011

    hey,

    As  Ithink that if you use the cffil tag with attribute rename then once you save the file in same destination then it will rename the file name either already exsist error comes. so it is good approch to create some new name dynamically once u save the file ex.

    <cfset file_name = DateFormate(Now())_file.doc >

    And use it.

    Thank you.

    Inspiring
    September 15, 2011

    What did the docs say?  You did check them, right?

    http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7377.html

    Bottom line is: no.  When renaming a file, you should check to see if you're trying to steamroll over an existing file before trying to rename it.  The reason why there's the nameconflict thing on upload is that the code has no control over what the incoming file name is, so it needs to deal with it.  Not so with a rename.

    --

    Adam