|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||
|
|||
|
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?
|
|
#3
|
|||
|
|||
|
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:
|
|
#4
|
|||
|
|||
|
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 |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > cffile action=rename dies with Cold Fusion MX |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|