FTP using ASP

A

AP

Is it possible to use ASP to "FtpPut" or "FtpDelete" a file in an FTP
server ?

For example, in VBA I can do the following to "put" a file to an FTP
server (can something similar be done in ASP - I'm just doing a
feasibility study to see if ASP is the correct platform for me -
thanks):

Public hConnection As Long, hOpen As Long, sOrgPath As String
Public Const INTERNET_OPEN_TYPE_PRECONFIG = 0
Public Const INTERNET_DEFAULT_FTP_PORT = 21
Public Const INTERNET_SERVICE_FTP = 1
Public Const INTERNET_FLAG_PASSIVE = &H8000000
Public Const FTP_TRANSFER_TYPE_UNKNOWN = &H0

'Connect FTP server
strLogon = "xxxxxxx"
strPwd = "xxxxxxx"
hOpen = InternetOpen("Example", INTERNET_OPEN_TYPE_PRECONFIG,
vbNullString, vbNullString, 0)
hConnection = InternetConnect(hOpen, FtpServer,
INTERNET_DEFAULT_FTP_PORT, strLogon, strPwd, INTERNET_SERVICE_FTP, IIf
(PassiveConnection, INTERNET_FLAG_PASSIVE, 0), 0)
sOrgPath = String(MAX_PATH, 0)
FtpGetCurrentDirectory hConnection, sOrgPath, Len(sOrgPath)

'FTP
subfolder_name = "xxxxxxx"
FtpSetCurrentDirectory hConnection, subfolder_name
FtpPutFile hConnection, "C:\" & f & ".txt", f & ".txt",
FTP_TRANSFER_TYPE_UNKNOWN, 0
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top