(Classic ASP) Create Directory on FTP Server
Classic ASP example showing how to create a new directory on an FTP site.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example requires the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
' For versions of Chilkat < 10.0.0, use CreateObject("Chilkat_9_5_0.Ftp2")
set ftp = Server.CreateObject("Chilkat.Ftp2")
ftp.Hostname = "ftp.example.com"
ftp.Username = "login"
ftp.Password = "password"
' Connect and login to the FTP server.
success = ftp.Connect()
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( ftp.LastErrorText) & "</pre>"
Response.End
End If
' Create a new directory on the FTP server:
success = ftp.CreateRemoteDir("newDirName")
If (success <> 1) Then
Response.Write "<pre>" & Server.HTMLEncode( ftp.LastErrorText) & "</pre>"
Response.End
End If
success = ftp.Disconnect()
%>
</body>
</html>
|