Noob trying to upload a file to ftp
Hi, everyone.
I am trying to create a form to upload a file to a server via ftp. However I keep running into errors, especially concerning the destination of the file. I have put the code below.
Any help would be appreciated.
Code:
<!--- Upload the file --->
<cfif isDefined("fileUpload")>
<cffile
action="upload"
filefield="fileUpload"
destination="">
</cfif>
<form enctype="multipart/form-data" method="post">
<input type="file" name="fileUpload" /><br />
<input type="submit" value="Upload File" />
</form>
<!--- Get the filename
<cfset FileName = CFFILE.ServerFile> --->
<!--- BEGIN REMOVE - DEBUGGING
<cfoutput>#FileName#</cfoutput>
END REMOVE - DEBUGGING --->
<!--- Open an FTP Connection --->
<cfftp
connection = "myConnection"
username = ""
password = ""
server = "129.1.26.15"
action = "open"
stopOnError = "Yes">
<!--- BEGIN REMOVE - DEBUGGING --->
<p>Did Open Connection succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<!--- END REMOVE - DEBUGGING --->
<!--- put the file --->
<cfftp
connection = "myConnection"
action = "putFile"
transferMode = "binary"
localFile = "F:\temp\#FileName#"
remoteFile = "129.1.26.15/users/mis405spr10/rsuciu/omfoto/upload/NEW_#FileName#">
<!--- BEGIN REMOVE - DEBUGGING --->
<p>Did Upload succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<!--- END REMOVE - DEBUGGING --->
<!--- Close the connection --->
<cfftp
connection = "myConnection"
action = "close"
stopOnError = "Yes">
<!--- BEGIN REMOVE - DEBUGGING --->
<p>Did Close Connection succeed? <cfoutput>#cfftp.succeeded#</cfoutput>
<!--- END REMOVE - DEBUGGING --->
<!--- Delete the local file --->
<cffile
action="delete"
file="C:\Inetpub\wwwroot\TEMP\#FileName#">
