We are distributing a foxpro application that uses
Microsoft FTP to send files back to the server. Malicious
users dumped files on our Win 2K server when the ftp
service was perpetually enabled. So, I have a a few
questions:
1. Is it possible to send files to our server from within
a (remotely running) foxpro application without using ftp,
say using http instead of ftp.
2. Is there a way that the ftp service can be started and
stopped on the Win2k Server from within a foxpro
application running remotely?
3. Are there any other ways of sending small files to our
server from a remotely running foxpro application?
Thank you.
Humty
H> We are distributing a foxpro application that uses
H> Microsoft FTP to send files back to the server. Malicious
H> users dumped files on our Win 2K server when the ftp
H> service was perpetually enabled. So, I have a a few
H> questions:
H> 1. Is it possible to send files to our server from within
H> a (remotely running) foxpro application without using ftp,
H> say using http instead of ftp.
HTTP should work. Not sure if it supports http file transfer, but you might
want to check wwipstuff from www.west-wind.com. You can also use webserver
based scripts. I know there are free Perl scripts available on the net.
However, if you want to play it save, use a VPN connection. You can have
your VFP app to dial in to a remote VPN server, drop the files using FTP or
simply by using the COPY FILE command. Use the STRUCT class from
www.universalthread.com to dial in to RAS/VPN servers.
Didn't you set up a password & user name on the FTP server?
H> 2. Is there a way that the ftp service can be started and
H> stopped on the Win2k Server from within a foxpro
H> application running remotely?
I think this can be done if you're logged on to the LAN of the FTP server
(can be done using VPN). You might have to install the Windows 2000 Resource
Kit on the remote computer.
H> 3. Are there any other ways of sending small files to our
H> server from a remotely running foxpro application?
E-mail?
--
Eric den Doop
www.foxite.com - The Home Of The Visual FoxPro Experts - Powered By VFP8
Instead of allowing anyone and everyone to FTP files to you,
password-protect that directory with a password known only to your
application.
You could use http, but you'll end up with the same problem as long as
you're allowing anonymous connections.
Dan
"Humty" <humt...@yahoo.com> wrote in message
news:019701c35864$4ed0b360$a501...@phx.gbl...
I use a library called Focus.fll from www.fastwrite.com it has ton of
functions specially for VFP applications, including FTP, ZIP(without
password yet!), etc. All the functions are very well documented and really
easy to use. For a project I was experimenting with the Mabry controls and
I had to code so many lines to make it work, with the functions in Focus.fll
it was like 123 <s>.
P.S.
All the functions are very well documented.
--
Edhy Rijo
Programming System Solutions www.progytech.com
Bronx NY
"Glen Wagner" <mozil...@hotmail.com> wrote in message
news:02c601c35883$7aaaa670$a501...@phx.gbl...
#DEFINE GENERIC_READ 2147483648 && &H80000000
#DEFINE GENERIC_WRITE 1073741824 && &H40000000
PUBLIC hOpen, hFtpSession
DECLARE INTEGER InternetOpen IN wininet.dll;
STRING sAgent,;
INTEGER lAccessType,;
STRING sProxyName,;
STRING sProxyBypass,;
STRING lFlags
DECLARE INTEGER InternetCloseHandle IN wininet.dll;
INTEGER hInet
DECLARE INTEGER InternetConnect IN wininet.dll;
INTEGER hInternetSession,;
STRING sServerName,;
INTEGER nServerPort,;
STRING sUsername,;
STRING sPassword,;
INTEGER lService,;
INTEGER lFlags,;
INTEGER lContext
DECLARE INTEGER FtpOpenFile IN wininet.dll;
INTEGER hFtpSession,;
STRING sFileName,;
INTEGER lAccess,;
INTEGER lFlags,;
INTEGER lContext
DECLARE INTEGER InternetWriteFile IN wininet.dll;
INTEGER hFile,;
STRING @ sBuffer,;
INTEGER lNumBytesToWrite,;
INTEGER @ dwNumberOfBytesWritten
IF connect2ftp ("ftp.yourftpserver.com", "user", "password")
lcSourcePath = "C:\upload\" && local folder
lcTargetPath = "/www/" && remote folder (ftp server)
lnFiles = ADIR (arr, lcSourcePath + "*.*")
FOR lnCnt=1 TO lnFiles
lcSource = lcSourcePath + LOWER (arr [lnCnt, 1])
lcTarget = lcTargetPath + LOWER (arr [lnCnt, 1])
? lcSource + " -> " + lcTarget
?? local2ftp (hFtpSession, lcSource, lcTarget)
ENDFOR
= InternetCloseHandle (hFtpSession)
= InternetCloseHandle (hOpen)
ENDIF
FUNCTION connect2ftp (strHost, strUser, strPwd)
** Abrimos el acceso.
hOpen = InternetOpen ("vfp", 1, 0, 0, 0)
IF hOpen = 0
? "No tiene acceso a WinInet.Dll"
RETURN .F.
ENDIF
** Connect to FTP.
hFtpSession = InternetConnect (hOpen, strHost, 0, strUser, strPwd, 1, 0,
0)
IF hFtpSession = 0
** Close
= InternetCloseHandle (hOpen)
? "FTP " + strHost + " not ready"
RETURN .F.
ELSE
? "Conectado a " + strHost + " como: [" + strUser + ", *****]"
ENDIF
RETURN .T.
**--------------------------------------------
** Copia del/los archivos
**--------------------------------------------
FUNCTION local2ftp (hConnect, lcSource, lcTarget)
** Upload local file to ftp server
hSource = FOPEN (lcSource)
IF (hSource = -1)
RETURN -1
ENDIF
** New file in ftp server
hTarget = FtpOpenFile(hConnect, lcTarget, GENERIC_WRITE, 2, 0)
IF hTarget = 0
= FCLOSE (hSource)
RETURN -2
ENDIF
lnBytesWritten = 0
lnChunkSize = 512 && 128, 512
DO WHILE Not FEOF(hSource)
lcBuffer = FREAD (hSource, lnChunkSize)
lnLength = Len(lcBuffer)
IF lnLength > 0
IF InternetWriteFile (hTarget, @lcBuffer, lnLength, @lnLength) =
1
lnBytesWritten = lnBytesWritten + lnLength
? lnBytesWritten
** Show Progress
ELSE
EXIT
ENDIF
ELSE
EXIT
ENDIF
ENDDO
= InternetCloseHandle (hTarget)
= FCLOSE (hSource)
RETURN lnBytesWritten
"Glen Wagner" <mozil...@hotmail.com> escribió en el mensaje
news:02c601c35883$7aaaa670$a501...@phx.gbl...
GW> Can someone give me some sample code has to how to initate
GW> a file transfer from within Foxpro.
GW> I have an import and export routine that sure could use
GW> such a thing
Download the free FTPCLASS from the universalthread for a complete FTP
solution written in VFP.
-Humty
>.
>
"Glen Wagner" <mozil...@hotmail.com> escribió en el mensaje
news:86bd01c35ae5$4d36e640$a001...@phx.gbl...
I see you still have some problems with this <s>. Just download the demo
for focus.fll and try, it may surprise you! That's what I did, after getting
frustrated with Mabry, the Focus.fll came to the rescue, www.fastwrite.com
--
Edhy Rijo
Programming System Solutions www.progytech.com
Bronx NY
"Glen Wagner" <mozil...@hotmail.com> wrote in message
news:86bd01c35ae5$4d36e640$a001...@phx.gbl...