I need a vfp app to connect to a ftp server and download updates and
patches. I have absolutly no explerience on this, so any ideas will be
wellcomed.
thanks,
Rafael
rvilar@usa.net
My partner did this using westwind an a couple of hours. Ok Clark had
hundreds of WW hours under his belt by then.
Stephen Russell
Developer - Clinical Data Repository
St Jude Children's Research Hospital
(901) 495-3807 - Office
(901) 246-0159 - Cell
-----Original Message-----
From: Rafael Vilar [mailto:rvilar@usa.net]
Sent: Tuesday, June 04, 2002 10:54 AM
To: Multiple recipients of ProFox
Subject: FTP from vfp
I need a vfp app to connect to a ftp server and download updates and
patches. I have absolutly no explerience on this, so any ideas will be
wellcomed.
thanks,
Rafael
rvilar@usa.net
West Wind (www.west-wind.com) sells their wwipstuff library which is =
inexpensive and has a nice easy to use FTP implementation. I use it and =
highly recommend it.
-----Original Message-----
From: Rafael Vilar [mailto:rvilar@usa.net]
Sent: Tuesday, June 04, 2002 10:54 AM
To: Multiple recipients of ProFox
Subject: FTP from vfp
I need a vfp app to connect to a ftp server and download updates and
patches. I have absolutly no explerience on this, so any ideas will be
wellcomed.
thanks,
Rafael
rvilar@usa.net
Rafael,
Here's a little program I wrote a few months ago to push a file onto a
web server via FTP. I'm sure it could easily be modified to pull a
file. I believe I got the bulk of this code (and modified it) from
http://www.news2news.com/vfp/?group=3D-1&=3D0 so if you need more info, =
you
might check there.
HTH
J. Chad Bourque, MCP
Fort=E9 Incorporated
chad@teche.net=20
#DEFINE INTERNET_INVALID_PORT_NUMBER 0 =20
#DEFINE INTERNET_OPEN_TYPE_DIRECT 1 =20
#DEFINE INTERNET_SERVICE_FTP 1 =20
#DEFINE FTP_TRANSFER_TYPE_ASCII 1 =20
#DEFINE FTP_TRANSFER_TYPE_BINARY 2 =20
PUBLIC hOpen, hFtpSession =20
DO decl =20
* select FTP connection providing you an appropriate access level =20
* in all cases it can not be any "anonymous" access =20
IF connect2ftp ("nnn.nnn.nnn.nnn", "username", "password")
*!* Where nnn.nnn.nnn.nnn is the IP address =20
* select the existing source and valid target file names =20
* these names are as an example only =20
lcSource =3D "c:\dev\CurrentNovus.html" =20
lcTarget =3D "/webroot/sitesecure/CurrentAddress.html"=20
*!* lcRenamed =3D "/webroot/sitesecure/CurrentAddress.ht~"=20
*!* =20
* default transfer type selected - =20
* the file is transfered exactly as it is =20
IF FtpPutFile (hFtpSession, lcSource,;=20
lcTarget, FTP_TRANSFER_TYPE_BINARY, 0) =3D 1=20
*!* * if file (lcRenamed) already exists, most probably it
would be replaced=20
*!* * with the new one during the renaming=20
*!* * at least my FTP server acts like this=20
*!* ? FtpRenameFile (hFtpSession, lcTarget, lcRenamed)=20
ENDIF=20
=3D InternetCloseHandle (hFtpSession) =20
=3D InternetCloseHandle (hOpen) =20
ENDIF =20
PROCEDURE decl =20
DECLARE INTEGER InternetOpen IN wininet.dll; =20
STRING sAgent,; =20
INTEGER lAccessType,; =20
STRING sProxyName,; =20
STRING sProxyBypass,; =20
STRING lFlags =20
=20
DECLARE INTEGER InternetCloseHandle IN wininet.dll INTEGER hInet =20
DECLARE INTEGER InternetConnect IN wininet.dll; =20
INTEGER hInternetSession,; =20
STRING sServerName,; =20
INTEGER nServerPort,; =20
STRING sUsername,; =20
STRING sPassword,; =20
INTEGER lService,; =20
INTEGER lFlags,; =20
INTEGER lContext =20
DECLARE INTEGER FtpPutFile IN wininet.dll; =20
INTEGER hConnect,; =20
STRING lpszLocalFile,; =20
STRING lpszNewRemoteFile,; =20
INTEGER dwFlags,; =20
INTEGER dwContext =20
DECLARE INTEGER FtpRenameFile IN wininet.dll;=20
INTEGER hConnect,;=20
STRING lpszExisting,;=20
STRING lpszNew=20
RETURN =20
FUNCTION connect2ftp (strHost, strUser, strPwd) =20
* open access to Inet functions =20
hOpen =3D InternetOpen ("vfp", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0) =
=20
IF hOpen =3D 0 =20
? "Unable to get access to WinInet.Dll" =20
RETURN .F. =20
ENDIF =20
* connect to FTP =20
hFtpSession =3D InternetConnect (hOpen, strHost,
INTERNET_INVALID_PORT_NUMBER,; =20
strUser, strPwd, INTERNET_SERVICE_FTP, 0, 0) =20
IF hFtpSession =3D 0 =20
* close access to Inet functions and exit =20
=3D InternetCloseHandle (hOpen) =20
? "FTP " + strHost + " is not available" =20
RETURN .F. =20
ELSE =20
? "Connected to " + strHost + " as: [" + strUser + ", *****]"
ENDIF =20
RETURN .T.
There's the FoxSocks Project at http://foxsocks.sourceforge.net that might
be of some interest to you. It uses the Winsock control that comes with VFP
(and all Visual Studio dev. tools) and implements common internet protocols
including FTP as a set of classes with an Open-Source license (meaning it's
free ... like speech, not beer <g>). These aren't black-box API calls that
you can't control like other solutions. You get total sourcecode control
over the protocols and can completely modify them to your needs if you want.
However, the project is stalled at the moment due to the major changes in
VFP 7's behavior dealing with non-native control events. We're trying to
support both VFP6 and 7 behaviors and it's going slow right now getting it
to work completely reliably in both environments with one codebase. Still,
the work continues and we'll get it worked out soon.
- Andrew Hilton
> I need a vfp app to connect to a ftp server and download updates and
> patches. I have absolutly no explerience on this, so any ideas will be
> wellcomed.
>
> thanks,
>
> Rafael
> rvilar@usa.net
There's a class to do this posted on the UniversalThread by Robert
Abram. It was easy to use.
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
cindy.winegarden@mvps.org
-----Original Message-----
From: profox@leafe.com [mailto:profox@leafe.com] On Behalf Of Rafael
Vilar
Sent: Tuesday, June 04, 2002 11:54 AM
To: Multiple recipients of ProFox
Subject: FTP from vfp
I need a vfp app to connect to a ftp server and download updates and
patches. I have absolutly no explerience on this, so any ideas will be
wellcomed.
thanks,
Rafael
rvilar@usa.net
Hilto, yes, you're right. It sound interesting but the question is: Is it
working for vfp7 or not? (Maybe you said it clearly in your message but I
sometimes miss the meaning of some words)
I'm using vfp7 and if this solution works I thinks that I'd like to take a
look.
thanks,
Rafael
----- Original Message -----
From: "AHilton" <ahilton@usexpr.com>
To: "Multiple recipients of ProFox" <profox@leafe.com>
Sent: Tuesday, June 04, 2002 3:10 PM
Subject: RE: FTP from vfp
> There's the FoxSocks Project at http://foxsocks.sourceforge.net that might
> be of some interest to you. It uses the Winsock control that comes with
VFP
> (and all Visual Studio dev. tools) and implements common internet
protocols
> including FTP as a set of classes with an Open-Source license (meaning
it's
> free ... like speech, not beer <g>). These aren't black-box API calls that
> you can't control like other solutions. You get total sourcecode control
> over the protocols and can completely modify them to your needs if you
want.
>
> However, the project is stalled at the moment due to the major changes in
> VFP 7's behavior dealing with non-native control events. We're trying to
> support both VFP6 and 7 behaviors and it's going slow right now getting it
> to work completely reliably in both environments with one codebase. Still,
> the work continues and we'll get it worked out soon.
>
> - Andrew Hilton
>
>
> > I need a vfp app to connect to a ftp server and download updates and
> > patches. I have absolutly no explerience on this, so any ideas will be
> > wellcomed.
> >
> > thanks,
> >
> > Rafael
> > rvilar@usa.net
>
>
>
>
Hilto, I subscribed to the list, but now what? I don't see a place to login,
or where to find those classes. Tell me,
Rafael
rvilar@usa.net
----- Original Message -----
From: "AHilton" <ahilton@usexpr.com>
To: "Multiple recipients of ProFox" <profox@leafe.com>
Sent: Tuesday, June 04, 2002 3:10 PM
Subject: RE: FTP from vfp
> There's the FoxSocks Project at http://foxsocks.sourceforge.net that might
> be of some interest to you. It uses the Winsock control that comes with
VFP
> (and all Visual Studio dev. tools) and implements common internet
protocols
> including FTP as a set of classes with an Open-Source license (meaning
it's
> free ... like speech, not beer <g>). These aren't black-box API calls that
> you can't control like other solutions. You get total sourcecode control
> over the protocols and can completely modify them to your needs if you
want.
>
> However, the project is stalled at the moment due to the major changes in
> VFP 7's behavior dealing with non-native control events. We're trying to
> support both VFP6 and 7 behaviors and it's going slow right now getting it
> to work completely reliably in both environments with one codebase. Still,
> the work continues and we'll get it worked out soon.
>
> - Andrew Hilton
>
>
> > I need a vfp app to connect to a ftp server and download updates and
> > patches. I have absolutly no explerience on this, so any ideas will be
> > wellcomed.
> >
> > thanks,
> >
> > Rafael
> > rvilar@usa.net
>
>
>
>
The code, as posted on the FTP server I mentioned in another message to you
*does* work in both VFP6 and VFP7. But it's a mess. I'm seriously
considering splitting the FoxSocks codebase into a VFP6 and VFP7 version. I
hate to do that but the hoops I'm having to jump thru in order to accomodate
VFP7 just makes the code even uglier than *I* can make it normally.
If you need an FTP solution immediately (within the next week for example)
then I would recommend Rick Strahl's wwIPStuff. It'll probably accomplish
most of what you want to do with FTP right now. If you can wait another
week or so, then I'll have the FoxSocks FTP portion complete for VFP7 AND
have the code so that it is readable and understandable (probably as a
separate codebase from the VFP6 version as mentioned above). It'll give you
total freedom to modify all the way down to the FTP protocol level as well
as be free to use and community supported and developed.
- Andrew Hilton
> Hilto, yes, you're right. It sound interesting but the question is: Is it
> working for vfp7 or not? (Maybe you said it clearly in your message but I
> sometimes miss the meaning of some words)
>
> I'm using vfp7 and if this solution works I thinks that I'd like to take a
> look.
>
>
> thanks,
>
> Rafael
I use the normal ftp program included in all windows version.
You can take a look via ftp /? In the command prompt for further
details.
This is how I automate it:
** I create a txt file
If File("pierre.txt")
Erase ("pierre.txt")
Endif
p=Fcreate("pierre.txt")
FPUTS(p,"open "+aLLTRIM(PARM1.DEF_SEL_TYP))
FPUTS(p,"user af"+parm1.afnum+" "+parm1.afpass)
FPUTS(p,"CD in ")
FPUTS(p,"put "+mFactfile+" "+SUBSTR(mFactfile,4,12))
FPUTS(p,"CD ..")
FPUTS(p,"CD out")
FPUTS(p,"GET test.TXT G:\S4LIF033.TXT ")
FPUTS(p,"quit")
FCLOSE(p)
**then I run the sendftp.bat
!Sendftp
**sendftp.bat
ftp -n -s:pierre.txt