![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
FTP Upload File
Upload a file from an ASP web server to an FTP server. <HTML>
<HEAD>
<meta HTTP-EQUIV="Content-Type" CONTENT="text/html;CHARSET=utf-8">
<TITLE>ASP FTP Upload File</TITLE>
</HEAD>
<BODY>
<%
' Create an FTP object
set ftp = Server.CreateObject("Chilkat_9_5_0.Ftp2")
' Any unlock code begins the 30-day trial
ftp.UnlockComponent "anything"
ftp.Username = "***"
ftp.Password = "***"
ftp.Hostname = "ftp.chilkatsoft.com"
ftp.KeepSessionLog = 1
ok = ftp.Connect()
if (ok <> 1) then
Response.Write ftp.LastErrorHtml
else
ok = ftp.ChangeRemoteDir("test")
' Normally you would check to make sure ok = 1
localFilename = Server.MapPath("/data/pigs.xml")
remoteFilename = "pigs.xml"
' Upload a file from the ASP web server to an FTP server.
ok = ftp.PutFile(localFilename, remoteFilename)
if (ok <> 1) then
Response.Write "<pre>"
Response.Write ftp.LastErrorText
Response.Write Server.HtmlEncode(ftp.SessionLog)
Response.Write "</pre>"
else
Response.Write "File uploaded!"
end if
end if
Set ftp = Nothing
%>
</BODY>
</HTML>
|
|||||
© 2000-2026 Chilkat Software, Inc. All Rights Reserved.