|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
|||
|
|||
|
cfftp and delete
hi all,
i'm trying to use cfftp to putfile to a server then delete a file locally... but it doesn't work. can anyone help? open a connection cfftp.... putfile... local...to..remote close connection delete... local file... error: invalid attribute <cffile action="delete" file="...."> filename.... |
|
#2
|
|||
|
|||
|
Please post the actual error message.
|
|
#3
|
|||
|
|||
|
attribute validation error for cffile... that is for cffile write
|
|
#4
|
|||
|
|||
|
The value of the attribute file, which is currently "c:\CFusionMX\wwwroot\myapps\upload-2-server\monthly-pages\file2.cfm", is invalid.
|
|
#5
|
|||
|
|||
|
it's weird because if i delete the file first then upload... the delete will work. but if i upload then delete either with the connection open or closed... it will not work.
|
|
#6
|
|||
|
|||
|
hmmm...ok, could you post the actual code that you are trying to run?
also, what version of CF are you using? |
|
#7
|
|||
|
|||
|
i am using dreamweaver coldfusionMX.
Code: <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <cfset filenameupl="monthly-pages\file2.cfm"> <cfset filenamedel="monthly-pages\file2.cfm"> Testing upload then delete a file<br> 1. Upload<br> <cfif fileexists("C:\CFusionMX\wwwroot\myapps\upload-2-server\#filenameupl#") or fileexists("C:\CFusionMX\wwwroot\myapps\upload-2-server\trashcan\#filenameupl#")> <!-- OPEN CONNECTION --> <cfftp connection="myconnection" server="servername" stoponerror="yes" username="user" password="passwd" action="open"> <cfif CFFTP.Succeeded> <cfoutput> uploaded #filenameupl# <br> <cfset newfilename = #Replace(filenameupl, "\", "/", "all")#> <!-- PUT FILE TO REMOTE SERVER --> <cfif fileexists("C:\CFusionMX\wwwroot\myapps\upload-2-server\#filenameupl#")> <cfftp connection="myconnection" action="putfile" localfile="c:\CFusionMX\wwwroot\myapps\upload-2-server\#filenameupl#" remotefile="/remote/announcements/#newfilename#" transfermode="AUTO"> <cfelse> <cfftp connection="myconnection" action="putfile" localfile="c:\CFusionMX\wwwroot\myapps\upload-2-server\trashcan\#filenameupl#" remotefile="/remote/announcements/#newfilename#" transfermode="AUTO"> </cfif> </cfoutput> <!-- DISCONNECT FROM SERVER --> <cfftp connection="myconnection" server="servername" stoponerror="yes" action="close"> <cfelse> There was an error connecting to the FTP server.<br> <hr><br><cfoutput> CFFTP.ErrorText </cfoutput> </cfif> </cfif> 2. Delete<br> <cfif fileexists("C:\CFusionMX\wwwroot\myapps\upload-2-server\#filenamedel#")> <cfoutput> deleted #filenamedel# <br> <cffile action="delete" file="c:\CFusionMX\wwwroot\myapps\upload-2-server\#filenamedel#"> </cfoutput> </cfif> </body> </html> Last edited by KIMMIE : September 4th, 2003 at 08:30 AM. |
|
#8
|
|||
|
|||
|
hmmm, very strange because if the file didn't exist you would not get past this line:
<cfif fileexists("C:\CFusionMX\wwwroot\myapps\upload-2-server\#filenamedel#")> My guess is that maybe the file is still locked and in use by the ftp put when the engine gets to the cffile. Can you try doing the upload and the delete in two different requests and see if it works then? Also, just for fun, can you do any other CFFILE operations on the file after the PUT? Like rename or read? |
|
#9
|
|||
|
|||
|
copy works
|
![]() |
| Viewing: Dev Shed Forums > System Administration > FTP Help > cfftp and delete |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|