Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Write ftp a file from a classic ASP program

Posted on 2006-11-15
4
Medium Priority
?
1,143 Views
Last Modified: 2011-09-20
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=server.mapPath(strFile)
  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


  objTextFile.WriteLine(Base64Data)
  objTextFile.Close
0
Comment
Question by:Hojoformo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 25

Expert Comment

by:kevp75
ID: 17953376
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?
0
 
LVL 58

Expert Comment

by:amit_g
ID: 17953871
strDirectory="C:\Inetpub\wwwroot\Base64Data.txt"

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
      oTextStream.Close
      Set oTextStream = nothing
   End if
   Set oFS = nothing
   ReadFile = sFileContents
End Function
0
 

Author Comment

by:Hojoformo
ID: 17958838
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()

0
 
LVL 58

Accepted Solution

by:
amit_g earned 2000 total points
ID: 17963291
>> 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.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question