Write ftp a file from a classic ASP program

How do I ftp a file from a classic asp program stored on a application server?  In other words ftp the file?  I want to transmit the file to my C:\ local drive on my workstation.   I do not want to write or create the file on the server just assemble the file and then transmit.   I have never used a FTP process in classic ASP

dim xmldata
  dim Base64Data
  ' Save the bit file
  Dim objFSO, objFSOText, objFolder, objFile
  Dim strDirectory, strFile
  Const ForAppending = 8
  set objFile = nothing
  set objFolder = nothing

  strFile = "Base64Data.txt"
  strDirectory="C:\Inetpub\wwwroot\Base64Data.txt"  ???? How can I transfer this file to workstation?
' Create the File System Object
  Set objFSO = CreateObject("Scripting.FileSystemObject")

  Set objFile = objFSO.CreateTextFile(strDirectory)
  Set objTextFile = objFSO.OpenTextFile(strDirectory, ForAppending, true)

  Base64Data = oXML.xml
  Base64Data = Base64EncodeBinary(oXML.xml

Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

amit_gConnect With a Mentor Commented:
>> Call Response.Write(ReadFile(Base64Data))   ???  will this work?

No but since you already have it in a variable, you should instead do

Call Response.Write(Base64Data)

and that should work.
i'm a bit confused by what you are trying to do...

are you trying to download a file to your computer from a web page?

Call Response.Clear()
Response.ContentType = "application/x-unknown"
Call Response.AddHeader("Content-Disposition", "attachment; filename=Base64Data.txt")
Call Response.Write(ReadFile(strDirectory))
Call Response.End()

Function ReadFile(sFilePathAndName)
   dim sFileContents
   Set oFS = Server.CreateObject("Scripting.FileSystemObject")
   If oFS.FileExists(sFilePathAndName) = True Then        
      Set oTextStream = oFS.OpenTextFile(sFilePathAndName,1)
      sFileContents = oTextStream.ReadAll
      Set oTextStream = nothing
   End if
   Set oFS = nothing
   ReadFile = sFileContents
End Function
HojoformoAuthor Commented:
Thanks Amit.  I have a question.  Will this work for file in internal storage?  For example, if I want just send data that I created inside the program like this - Base64Data

Base64Data = Base64EncodeBinary(oXML.xml)

Call Response.Clear()
Response.ContentType = "application/x-unknown"
Call Response.AddHeader("Content-Disposition", "attachment; filename=Base64Data")
Call Response.Write(ReadFile(Base64Data))   ???  will this work?
Call Response.End()

All Courses

From novice to tech pro — start learning today.