FTP using ASP

Discussion in 'ASP General' started by AP, Jan 3, 2010.

  1. AP

    AP Guest

    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
     
    AP, Jan 3, 2010
    #1
    1. Advertisements

  2. Adrienne Boswell, Jan 5, 2010
    #2
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.