Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
FTP Copy
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00601065
Message ID:
00601793
Views:
31
>>I want to copy a file to and from an FTP site. I have found all sorts of apps to use. I would like to do something like this:
>>
>>copy junk.txt to ftp://login:password@100.12.15.25/outbox/junk.txt
>>
>>Is this possible? I have tried it until I am blue in the face with no luck. I have seen the other suggested apps and they all require user intervetion of some sort.
>>
>>The above example is for reference only. It may or may not work. Not in my office though! :-)
>
>Here's something that might do what you want:
>
>http://www.levelextreme.com/Magazine/November2001/Page20.asp
********
I use this method successfully and agree it is amazing how easily it works. The only thing not covered in the article that the original poster may want is the ability to dial-up a connection. I use the regular windows RAS. You set up your modem, id & password in control panel as usual. You can then connect using:
lnConnectionState = 0
fResult = InternetGetConnectedState(@lnConnectionState, 0)

Declare Integer InternetAutodialHangup In WinInet ;
   Integer nFlags

If lnConnectionState=81 && or lnConnectionState=18 && 1,81=online,82=offline, 18=on with network
   * Must hang up so we can call a new number

   InternetAutodialHangup(0)
Endif
*** to dialup on default ras
Declare Integer InternetDial In WinInet ;
   Integer nHandle, ;
   String @lpcDialUp, ;
   Integer nAccessType, ;
   Integer @nConnect_Handle, ;
   Integer nFlags

nInet_Handle = 0
If !Empty(YourConnectionNameHere)
   fResult2 = InternetDial(0,YourConnectionNameHere, 0x8000, @nInet_Handle, 0)
   If m.nInet_Handle = 0
      ssiMessage("The connection name in the ini file is "+YourConnectionNameHere+" and it does not work")
      YourConnectionNameHere = ""
   Endif
Endif
If m.nInet_Handle = 0
   * this is for the case where they did not send a connection, or they sent the wrong one
   fResult2 = InternetDial(0,"", 0, @nInet_Handle, 0)
Endif
If m.nInet_Handle = 0
   ssiMessage("Unable to make a dial-up connection to this payer")
   YourConnectionNameHere = ""
Else

   lnConnectionState = 0
   fResult = InternetGetConnectedState(@lnConnectionState, 0)
   If lnConnectionState != 81 && or lnConnectionState=18 && 1,81=online,82=offline, 18=on with network
      ssiMessage("Unable to connect to the FTP Network")
   Else

here you are connected and you continue with things listed in the article.
I modified this a little from my code to make it more readable so you may get an error or two.

I wish we could get something as simple as this to do a regular dial-up to a private network/bulletin board (non-internet/RAS) something like hyperterminal does.
Dr. Ken A. McGinnis
Healthcare software design
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform