Hej
Jeg bruger et FTP komponenet fra Chilkat
(
http://www.chilkatsoft.com/chilkatFtp.asp) til at uploade en fil der bliver
sendt via en formular. Det var også let nok at lave, men nu vil jeg gerne
undgå at filen bliver uploadet (eller i bedste fald bare renamet) hvis den
eksisterer i forvejen på serveren. Den foreløbige kode står herunder..
Mvh. Jacob
<%
'## Create object
Set objConnect = Server.CreateObject("Chilkatftp.ChilkatFTP")
'## Get hostname
objConnect.HostName = Session("ftp")
'## Get FTP username
objConnect.Username = Session("ftp_username")
'## Get FTP password
objConnect.Password = Session("ftp_password")
'## Connect to server
objConnect.Connect()
'## Get connect status
If objConnect.IsConnected = 1 Then
'## Change dir
objConnect.ChangeRemoteDir(Session("upload_directory"))
If objConnect.MPutFiles(Request.Form("fileupload")) = 1 Then
Response.Write "File uploaded!"
Else
Response.Write objConnect.ErrorLogHtml
End If
Else
Response.Write "Failed to connect to the server!"
End If
'## Disconnect
objConnect.Disconnect()
%>