ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 11th, 2005, 02:31 PM
kikkid97 kikkid97 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 kikkid97 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 13 sec
Reputation Power: 0
cffile action=rename dies with Cold Fusion MX

Please help! I'm desperate!!!! I cannot for the life of me figure out what is going on here.

The process:

User creates file, 'FileA.mpp' and uploads it to the server.
Code:
<cffile action="UPLOAD" 
  filefield="form.upload" 
  destination="#url.dir#" 
  nameconflict="MakeUnique"
  attributes="Normal" 
  accept="application/vnd.ms-project,application/vnd.ms-      powerpoint,text/plain,application/octet-stream">



User makes changes to the file, 'FileA.mpp' and uploads the newest version. Because the 'nameconfilct' attribute is set to 'MakeUnique', the newly uploaded file is given the name 'FileA1.mpp'.

I want to take the 'original' FileA.mpp and rename it by appending a date/time stamp. Next, I want to take the newly uploaded file, FileA1.mpp and rename it to the 'original' file name, FileA.mpp

Code:
<!---File that was already there before upload--->
<cfset existingfile = #cffile.clientfilename#>

<!---Extension of file already there before upload--->
<cfset kindoffile = "." & #cffile.clientfileext#>

<!---File that was just uploaded--->
<cfset uploadedfile = #cffile.serverfilename#>

<!---Date/Time stamp to append to original file name--->
<cfset AppendStamp = #DateFormat(Now(), 'mm_dd_yyyy')#>

<!---Rename the existing file by appending date/time stamp--->
<cfset renameexisting = #existingfile# & "_" & #AppendStamp# & #kindoffile#>

<!---Rename the uploaded file, give it the existing file's original name--->
<cfset renameuploaded = #existingfile# & #kindoffile#>

<!---Rename existing--->
<cffile action="rename" nameconflict="overwrite" source="#url.dir##existingfile##kindoffile#" destination="#url.dir##renameexisting#">

<!---Rename uploaded--->
<cffile action="rename" nameconflict="overwrite" source="#url.dir##uploadedfile##kindoffile#" destination="#url.dir##renameuploaded#">


I keep getting an error saying:

Code:
The value of the attribute source, which is currently "D:\PROJECTS\A.mpp", is invalid. 


I know that D:\PROJECTS\A.mpp is a valid path. Just to be sure, I tried hard coding the source and destination paths for both rename attempts and I keep getting the same error message.

User requirements prevent me from just overwriting the existing file during the upload process. Is this an MX issue? Is there a work around? Help!!!! I'm really going slightly bonkers over this one.

Reply With Quote
  #2  
Old February 11th, 2005, 03:22 PM
bfolger71 bfolger71 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Boston, MA
Posts: 47 bfolger71 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 34 sec
Reputation Power: 6
Is there a line number so you can identify where the error is being thrown? Additionally, have you tried <cfabort>ing and outputting the values for each variable at each step to confirm that they are what you expect them to be?

Reply With Quote
  #3  
Old February 11th, 2005, 03:45 PM
kikkid97 kikkid97 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 26 kikkid97 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 35 m 13 sec
Reputation Power: 0
To simplify, I took out the second cffile rename so now all I have is the rename attempt on the 'original' file:
Code:
<cffile action="rename" nameconflict="overwrite" source="#url.dir##existingfile##kindoffile#" destination="#url.dir##renameexisting


I still get the same error.


I know that the variables all output the correct values, however, even when I hard code the source and destination with paths I'm 100% positive are valid, I still get the error. I k


Quote:
Originally Posted by bfolger71
Is there a line number so you can identify where the error is being thrown? Additionally, have you tried <cfabort>ing and outputting the values for each variable at each step to confirm that they are what you expect them to be?

Reply With Quote
  #4  
Old February 11th, 2005, 04:22 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,682 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 42 m 54 sec
Reputation Power: 53
I would suggest eliminating all the code except your form page and the cffile. Forget all the other variable assignments, etc. If that works, start adding in one bit of logic at a time until you figure out where the problem is.

I would also confirm that it is not a permissions problem.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > cffile action=rename dies with Cold Fusion MX


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT