I'm curious to if there's a way I can get VFP9 to upload a file via ftp to a
secure area that requires a login.

Thanks!
Buster

Re: can VFP 9 ftp a file??? by Dan

Dan
Tue Nov 29 11:05:49 CST 2005

Sure there is. Use the WININET API.

Go to www.west-wind.com and download his Client Tools.

Dan

Bubba Gump Shrimp wrote:
> I'm curious to if there's a way I can get VFP9 to upload a file via
> ftp to a secure area that requires a login.
>
> Thanks!
> Buster



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 11:10:08 CST 2005

Can you give me a link to what you're referring to from his site. I did a
search for wininet and don't find anything with that name.

How much work does it require to set up and to get Fox to use it?

Thanks!
Buster


"Dan Freeman" <spam@microsoft.com> wrote in message
news:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
> Sure there is. Use the WININET API.
>
> Go to www.west-wind.com and download his Client Tools.
>
> Dan
>
> Bubba Gump Shrimp wrote:
>> I'm curious to if there's a way I can get VFP9 to upload a file via
>> ftp to a secure area that requires a login.
>>
>> Thanks!
>> Buster
>
>



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 11:13:57 CST 2005

ok, i think i found it here http://www.west-wind.com/wwClientTools.asp but
am curious as to something else before I try to figure out how to set it up.
I have a small program that is scheduled to run on it's own. What I'm
interested in is a way for this program when it runs to be able to perform
the ftp without user intervention.

Will this allow that? In other words, can I command my program to call this
app automatically and do it's stuff?

Thanks again Dan!
Buster

"Dan Freeman" <spam@microsoft.com> wrote in message
news:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
> Sure there is. Use the WININET API.
>
> Go to www.west-wind.com and download his Client Tools.
>
> Dan
>
> Bubba Gump Shrimp wrote:
>> I'm curious to if there's a way I can get VFP9 to upload a file via
>> ftp to a secure area that requires a login.
>>
>> Thanks!
>> Buster
>
>



Re: can VFP 9 ftp a file??? by Emile

Emile
Tue Nov 29 11:29:04 CST 2005

You can use a timer.

EM.

"Bubba Gump Shrimp" <none@microsoft.com> a écrit dans le message de news:
%23gnFKhQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
> ok, i think i found it here http://www.west-wind.com/wwClientTools.asp but
> am curious as to something else before I try to figure out how to set it
> up. I have a small program that is scheduled to run on it's own. What I'm
> interested in is a way for this program when it runs to be able to perform
> the ftp without user intervention.
>
> Will this allow that? In other words, can I command my program to call
> this app automatically and do it's stuff?
>
> Thanks again Dan!
> Buster
>
> "Dan Freeman" <spam@microsoft.com> wrote in message
> news:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
>> Sure there is. Use the WININET API.
>>
>> Go to www.west-wind.com and download his Client Tools.
>>
>> Dan
>>
>> Bubba Gump Shrimp wrote:
>>> I'm curious to if there's a way I can get VFP9 to upload a file via
>>> ftp to a secure area that requires a login.
>>>
>>> Thanks!
>>> Buster
>>
>>
>
>
>




Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 11:56:17 CST 2005

There are a few ways to tackle this. What I ended up doing was creating a
func that writes a batch file calling the windows FTP command and then run
it. May not be the best way but it's worked very reliably hundreds of times
a day....

Code looks something like this:

CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat') cCmd=(cDefhtml)+'c:\Upload.bat' run &cCmd************************************************************************function CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)strtofile(cBatString,cRptDir+'Upload.bat')cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'strtofile(cScrString,cRptDir+'FtpRpt.scr')return*!* cFtpDir =where the ftp.exe sits on your PC, could be \windows or\windows\system32 depending*!* cRptDir=source file path*!* cUploadDir=destination folder*!* cUser=user name*!* cPw=pasword*!* cIp=ip or dn to connect to*!* cFileName=file to transfer (can include wildcards)*!* Note: the CrLf() funciton simply adds a carriage return and line feedchr(13)+chr(10)"Bubba Gump Shrimp" <none@microsoft.com> wrote in messagenews:%23gnFKhQ9FHA.1420@TK2MSFTNGP09.phx.gbl...> ok, i think i found it here http://www.west-wind.com/wwClientTools.asp butam curious as to something else before I try to figure out how to set it up.I have a small program that is scheduled to run on it's own. What I'minterested in is a way for this program when it runs to be able to performthe ftp without user intervention.>> Will this allow that? In other words, can I command my program to callthis app automatically and do it's stuff?>> Thanks again Dan!> Buster>> "Dan Freeman" <spam@microsoft.com> wrote in messagenews:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...>> Sure there is. Use the WININET API.>>>> Go to www.west-wind.com and download his Client Tools.>>>> Dan>>>> Bubba Gump Shrimp wrote:>>> I'm curious to if there's a way I can get VFP9 to upload a file via>>> ftp to a secure area that requires a login.>>>>>> Thanks!>>> Buster>>>>>>


Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 11:56:20 CST 2005

Emile, is that a built in function of the west wind tools or what. Currently
I've got the program scheduled to run with a windows "sceduled task". So am
I understanding that west-wind runs independent of Fox and Fox wouldn't be
calling a process from West Wind?

Thanks!
Buster

"Emile Maitrejean" <fox-NSPAM@emsystems.be> wrote in message
news:eu2h0pQ9FHA.1188@TK2MSFTNGP12.phx.gbl...
> You can use a timer.
>
> EM.
>
> "Bubba Gump Shrimp" <none@microsoft.com> a écrit dans le message de news:
> %23gnFKhQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
>> ok, i think i found it here http://www.west-wind.com/wwClientTools.asp
>> but am curious as to something else before I try to figure out how to set
>> it up. I have a small program that is scheduled to run on it's own. What
>> I'm interested in is a way for this program when it runs to be able to
>> perform the ftp without user intervention.
>>
>> Will this allow that? In other words, can I command my program to call
>> this app automatically and do it's stuff?
>>
>> Thanks again Dan!
>> Buster
>>
>> "Dan Freeman" <spam@microsoft.com> wrote in message
>> news:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
>>> Sure there is. Use the WININET API.
>>>
>>> Go to www.west-wind.com and download his Client Tools.
>>>
>>> Dan
>>>
>>> Bubba Gump Shrimp wrote:
>>>> I'm curious to if there's a way I can get VFP9 to upload a file via
>>>> ftp to a secure area that requires a login.
>>>>
>>>> Thanks!
>>>> Buster
>>>
>>>
>>
>>
>>
>
>
>



Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 12:01:15 CST 2005

[my previous post had the cr and lf stripped]

"Ben" <nospam@nospam.com> wrote in message
news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
There are a few ways to tackle this. What I ended up doing was creating a
func that writes a batch file calling the windows FTP command and then run
it. May not be the best way but it's worked very reliably hundreds of
times
a day....

Code looks something like this:

CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
cCmd=(cDefhtml)+'c:\Upload.bat'
run &cCmd

************************************************************************
function CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
strtofile(cBatString,cRptDir+'Upload.bat')
cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
'+cRptDir+cFileName+CrLf()+'quit'
strtofile(cScrString,cRptDir+'FtpRpt.scr')
return

*!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
or\windows\system32 depending
*!* cRptDir=source file path
*!* cUploadDir=destination folder
*!* cUser=user name*!* cPw=pasword
*!* cIp=ip or dn to connect to
*!* cFileName=file to transfer (can include wildcards)
*!* Note: the CrLf() funciton simply adds a carriage return and line
feedchr(13)+chr(10)


>



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 12:08:19 CST 2005

This may be the easiest thing to do then in all honesty. So once I get my
output file, I can simply insert this code at the bottom of my already
created program. Correct?

Thanks!

"Ben" <nospam@nospam.com> wrote in message
news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
> [my previous post had the cr and lf stripped]
>
> "Ben" <nospam@nospam.com> wrote in message
> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
> There are a few ways to tackle this. What I ended up doing was creating a
> func that writes a batch file calling the windows FTP command and then run
> it. May not be the best way but it's worked very reliably hundreds of
> times
> a day....
>
> Code looks something like this:
>
> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
> cCmd=(cDefhtml)+'c:\Upload.bat'
> run &cCmd
>
> ************************************************************************
> function
> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
> strtofile(cBatString,cRptDir+'Upload.bat')
> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
> '+cRptDir+cFileName+CrLf()+'quit'
> strtofile(cScrString,cRptDir+'FtpRpt.scr')
> return
>
> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
> or\windows\system32 depending
> *!* cRptDir=source file path
> *!* cUploadDir=destination folder
> *!* cUser=user name*!* cPw=pasword
> *!* cIp=ip or dn to connect to
> *!* cFileName=file to transfer (can include wildcards)
> *!* Note: the CrLf() funciton simply adds a carriage return and line
> feedchr(13)+chr(10)
>
>
>>
>
>



Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 12:18:29 CST 2005

Yep...but I noticed a mistake when I trimmed out custome code I left in a
reference to (cDefHtml) in the cCmd string, you can get rid of that.

Been posting questions here a while, first time I think I've actually
answered one! hehe.

- Ben


"Bubba Gump Shrimp" <none@microsoft.com> wrote in message
news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
> This may be the easiest thing to do then in all honesty. So once I get my
> output file, I can simply insert this code at the bottom of my already
> created program. Correct?
>
> Thanks!
>
> "Ben" <nospam@nospam.com> wrote in message
> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>> [my previous post had the cr and lf stripped]
>>
>> "Ben" <nospam@nospam.com> wrote in message
>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>> There are a few ways to tackle this. What I ended up doing was creating
>> a
>> func that writes a batch file calling the windows FTP command and then
>> run
>> it. May not be the best way but it's worked very reliably hundreds of
>> times
>> a day....
>>
>> Code looks something like this:
>>
>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>> cCmd=(cDefhtml)+'c:\Upload.bat'
>> run &cCmd
>>
>> ************************************************************************
>> function
>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>> strtofile(cBatString,cRptDir+'Upload.bat')
>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>> '+cRptDir+cFileName+CrLf()+'quit'
>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>> return
>>
>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>> or\windows\system32 depending
>> *!* cRptDir=source file path
>> *!* cUploadDir=destination folder
>> *!* cUser=user name*!* cPw=pasword
>> *!* cIp=ip or dn to connect to
>> *!* cFileName=file to transfer (can include wildcards)
>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>> feedchr(13)+chr(10)
>>
>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 12:32:01 CST 2005

ok, I took that 9out. Trying to get it to work and it appears to work in
that I get no errors but the file doesn't upload and I don't see an
upload.bat file on the C drive.

I didn't specify a subfolder to upload to, is that needed?

I changed the file to be uploaded (*.bat) in the CreateUploadBat line to be
the actual txt filename that I need it to upload. Correct?

Thanks Ben!
Buster

I did verify my ftp.exe is in the windows\system32 folder so I left that
path in tact.
"Ben" <nospam@nospam.com> wrote in message
news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
> Yep...but I noticed a mistake when I trimmed out custome code I left in a
> reference to (cDefHtml) in the cCmd string, you can get rid of that.
>
> Been posting questions here a while, first time I think I've actually
> answered one! hehe.
>
> - Ben
>
>
> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>> This may be the easiest thing to do then in all honesty. So once I get my
>> output file, I can simply insert this code at the bottom of my already
>> created program. Correct?
>>
>> Thanks!
>>
>> "Ben" <nospam@nospam.com> wrote in message
>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>> [my previous post had the cr and lf stripped]
>>>
>>> "Ben" <nospam@nospam.com> wrote in message
>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>> There are a few ways to tackle this. What I ended up doing was creating
>>> a
>>> func that writes a batch file calling the windows FTP command and then
>>> run
>>> it. May not be the best way but it's worked very reliably hundreds of
>>> times
>>> a day....
>>>
>>> Code looks something like this:
>>>
>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>> run &cCmd
>>>
>>> ************************************************************************
>>> function
>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>> '+cRptDir+cFileName+CrLf()+'quit'
>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>> return
>>>
>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>> or\windows\system32 depending
>>> *!* cRptDir=source file path
>>> *!* cUploadDir=destination folder
>>> *!* cUser=user name*!* cPw=pasword
>>> *!* cIp=ip or dn to connect to
>>> *!* cFileName=file to transfer (can include wildcards)
>>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>>> feedchr(13)+chr(10)
>>>
>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 12:59:57 CST 2005

Give me 15 mins and I'll hook you up. BRB....

"Bubba Gump Shrimp" <none@microsoft.com> wrote in message
news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
> ok, I took that 9out. Trying to get it to work and it appears to work in
> that I get no errors but the file doesn't upload and I don't see an
> upload.bat file on the C drive.
>
> I didn't specify a subfolder to upload to, is that needed?
>
> I changed the file to be uploaded (*.bat) in the CreateUploadBat line to
> be the actual txt filename that I need it to upload. Correct?
>
> Thanks Ben!
> Buster
>
> I did verify my ftp.exe is in the windows\system32 folder so I left that
> path in tact.
> "Ben" <nospam@nospam.com> wrote in message
> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>> Yep...but I noticed a mistake when I trimmed out custome code I left in a
>> reference to (cDefHtml) in the cCmd string, you can get rid of that.
>>
>> Been posting questions here a while, first time I think I've actually
>> answered one! hehe.
>>
>> - Ben
>>
>>
>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>> This may be the easiest thing to do then in all honesty. So once I get
>>> my output file, I can simply insert this code at the bottom of my
>>> already created program. Correct?
>>>
>>> Thanks!
>>>
>>> "Ben" <nospam@nospam.com> wrote in message
>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>> [my previous post had the cr and lf stripped]
>>>>
>>>> "Ben" <nospam@nospam.com> wrote in message
>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>> There are a few ways to tackle this. What I ended up doing was
>>>> creating a
>>>> func that writes a batch file calling the windows FTP command and then
>>>> run
>>>> it. May not be the best way but it's worked very reliably hundreds of
>>>> times
>>>> a day....
>>>>
>>>> Code looks something like this:
>>>>
>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>> run &cCmd
>>>>
>>>> ************************************************************************
>>>> function
>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>> return
>>>>
>>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>>> or\windows\system32 depending
>>>> *!* cRptDir=source file path
>>>> *!* cUploadDir=destination folder
>>>> *!* cUser=user name*!* cPw=pasword
>>>> *!* cIp=ip or dn to connect to
>>>> *!* cFileName=file to transfer (can include wildcards)
>>>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>>>> feedchr(13)+chr(10)
>>>>
>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Emile

Emile
Tue Nov 29 13:10:07 CST 2005

Buster,
You will be able to find an VFP example in www.emsystems.be/befox.
Download via the heading "Télécharger".
The timer is not used, but it is easy to implement in VFP.
EM.

"Bubba Gump Shrimp" <none@microsoft.com> a écrit dans le message de news:
%23PT014Q9FHA.252@TK2MSFTNGP15.phx.gbl...
> Emile, is that a built in function of the west wind tools or what.
> Currently I've got the program scheduled to run with a windows "sceduled
> task". So am I understanding that west-wind runs independent of Fox and
> Fox wouldn't be calling a process from West Wind?
>
> Thanks!
> Buster
>
> "Emile Maitrejean" <fox-NSPAM@emsystems.be> wrote in message
> news:eu2h0pQ9FHA.1188@TK2MSFTNGP12.phx.gbl...
>> You can use a timer.
>>
>> EM.
>>
>> "Bubba Gump Shrimp" <none@microsoft.com> a écrit dans le message de news:
>> %23gnFKhQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
>>> ok, i think i found it here http://www.west-wind.com/wwClientTools.asp
>>> but am curious as to something else before I try to figure out how to
>>> set it up. I have a small program that is scheduled to run on it's own.
>>> What I'm interested in is a way for this program when it runs to be able
>>> to perform the ftp without user intervention.
>>>
>>> Will this allow that? In other words, can I command my program to call
>>> this app automatically and do it's stuff?
>>>
>>> Thanks again Dan!
>>> Buster
>>>
>>> "Dan Freeman" <spam@microsoft.com> wrote in message
>>> news:u8TFncQ9FHA.1420@TK2MSFTNGP09.phx.gbl...
>>>> Sure there is. Use the WININET API.
>>>>
>>>> Go to www.west-wind.com and download his Client Tools.
>>>>
>>>> Dan
>>>>
>>>> Bubba Gump Shrimp wrote:
>>>>> I'm curious to if there's a way I can get VFP9 to upload a file via
>>>>> ftp to a secure area that requires a login.
>>>>>
>>>>> Thanks!
>>>>> Buster
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
>




Re: can VFP 9 ftp a file??? by tnhoe

tnhoe
Tue Nov 29 12:56:19 CST 2005

PUBLIC arr[1], larr[1]

#DEFINE INTERNET_INVALID_PORT_NUMBER 0
#DEFINE INTERNET_OPEN_TYPE_DIRECT 1
#DEFINE INTERNET_SERVICE_FTP 1
#DEFINE FTP_TRANSFER_TYPE_ASCII 1
#DEFINE FTP_TRANSFER_TYPE_BINARY 2
#DEFINE INTERNET_FLAG_NEED_FILE 16
#DEFINE FILE_ATTRIBUTE_DIRECTORY 16

#DEFINE GENERIC_READ 2147483648 && &H80000000
#DEFINE GENERIC_WRITE 1073741824 && &H40000000

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 FtpFindFirstFile IN wininet.dll;
INTEGER hFtpSession, STRING lpszSearchFile,;
STRING @lpFindFileData, INTEGER dwFlags, INTEGER dwContent

DECLARE INTEGER InternetFindNextFile IN wininet.dll;
INTEGER hFind, STRING @lpvFindData

DECLARE INTEGER FtpGetCurrentDirectory IN wininet.dll;
INTEGER hFtpSession, STRING @lpszDirectory,;
INTEGER @lpdwCurrentDirectory

DECLARE INTEGER FtpSetCurrentDirectory IN wininet.dll;
INTEGER hFtpSession, STRING @lpszDirectory

DECLARE INTEGER FtpOpenFile IN wininet.dll;
INTEGER hFtpSession, STRING sFileName, INTEGER lAccess,;
INTEGER lFlags, INTEGER lContext

DECLARE INTEGER InternetReadFile IN wininet.dll;
INTEGER hFile, STRING @lpBuffer,;
INTEGER dwNumberOfBytesToRead, INTEGER @lpdwNumberOfBytesRead

DECLARE INTEGER FileTimeToSystemTime IN kernel32.dll;
STRING @lpFileTime, STRING @lpSystemTime

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 FtpPutFile IN wininet.DLL;
INTEGER hConnect,;
STRING lpszLocalFile,;
STRING lpszNewRemoteFile,;
INTEGER dwFlags,;
INTEGER dwContext

DECLARE INTEGER FtpRenameFile IN wininet.DLL;
INTEGER hConnect,;
STRING lpszExisting,;
STRING lpszNew

* select FTP connection providing you an appropriate access level
* in all cases it can not be any "anonymous" access
* connection parameters - you better put your data

cRemote='ftpdir/'
cTarget='yourfile.dbf'
cHost ='ftp.yourhost.com'
cLogin ='login'
cPwd ='password'

#DEFINE INTERNET_INVALID_PORT_NUMBER 0
#DEFINE INTERNET_OPEN_TYPE_DIRECT 1
#DEFINE INTERNET_SERVICE_FTP 1
#DEFINE FTP_TRANSFER_TYPE_ASCII 1
#DEFINE FTP_TRANSFER_TYPE_BINARY 2
#DEFINE INTERNET_FLAG_NEED_FILE 16
#DEFINE FILE_ATTRIBUTE_DIRECTORY 16

#DEFINE GENERIC_READ 2147483648 && &H80000000
#DEFINE GENERIC_WRITE 1073741824 && &H40000000

* open access to Inet functions
hOpen = InternetOpen ("vfp", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0)

IF hOpen = 0
MESSAGEBOX( "Unable to get access to WinInet.Dll", 0, 'Open error' )
RETURN .F.
ENDIF

* connect to FTP
hFtpSession = InternetConnect (hOpen, cHost,;
INTERNET_INVALID_PORT_NUMBER,;
cLogin,cPwd, INTERNET_SERVICE_FTP, 0, 0)

IF hFtpSession = 0
* close access to Inet functions and exit
= InternetCloseHandle (hOpen)
WAIT 'Upload error : '+cHost TIMEOUT 1
RETURN .F.
ENDIF

FtpPutFile (hFtpSession, cTarget,'/'+cRemote+cTarget,
FTP_TRANSFER_TYPE_ASCII, 0)

= InternetCloseHandle (hFtpSession)
= InternetCloseHandle (hOpen)

RETURN .t.




Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 13:22:53 CST 2005

subfolder isn't needed. I just ran this and it worked.

CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
cCmd='c:\upload.bat'
run &cCmd

you'll need to include this function.

function CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
'+alltrim(cIp)
strtofile(cBatString,cRptDir+'Upload.bat')
cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
'+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
strtofile(cScrString,cRptDir+'FtpRpt.scr')
return



"Ben" <nospam@nospam.com> wrote in message
news:Ny1jf.115$f41.25@tornado.rdc-kc.rr.com...
> Give me 15 mins and I'll hook you up. BRB....
>
> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
> news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
>> ok, I took that 9out. Trying to get it to work and it appears to work in
>> that I get no errors but the file doesn't upload and I don't see an
>> upload.bat file on the C drive.
>>
>> I didn't specify a subfolder to upload to, is that needed?
>>
>> I changed the file to be uploaded (*.bat) in the CreateUploadBat line to
>> be the actual txt filename that I need it to upload. Correct?
>>
>> Thanks Ben!
>> Buster
>>
>> I did verify my ftp.exe is in the windows\system32 folder so I left that
>> path in tact.
>> "Ben" <nospam@nospam.com> wrote in message
>> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>>> Yep...but I noticed a mistake when I trimmed out custome code I left in
>>> a reference to (cDefHtml) in the cCmd string, you can get rid of that.
>>>
>>> Been posting questions here a while, first time I think I've actually
>>> answered one! hehe.
>>>
>>> - Ben
>>>
>>>
>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>>> This may be the easiest thing to do then in all honesty. So once I get
>>>> my output file, I can simply insert this code at the bottom of my
>>>> already created program. Correct?
>>>>
>>>> Thanks!
>>>>
>>>> "Ben" <nospam@nospam.com> wrote in message
>>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>>> [my previous post had the cr and lf stripped]
>>>>>
>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>>> There are a few ways to tackle this. What I ended up doing was
>>>>> creating a
>>>>> func that writes a batch file calling the windows FTP command and then
>>>>> run
>>>>> it. May not be the best way but it's worked very reliably hundreds of
>>>>> times
>>>>> a day....
>>>>>
>>>>> Code looks something like this:
>>>>>
>>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>>> run &cCmd
>>>>>
>>>>> ************************************************************************
>>>>> function
>>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>>> return
>>>>>
>>>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>>>> or\windows\system32 depending
>>>>> *!* cRptDir=source file path
>>>>> *!* cUploadDir=destination folder
>>>>> *!* cUser=user name*!* cPw=pasword
>>>>> *!* cIp=ip or dn to connect to
>>>>> *!* cFileName=file to transfer (can include wildcards)
>>>>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>>>>> feedchr(13)+chr(10)
>>>>>
>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 13:52:52 CST 2005

Shouldn't the function come first so it can be defined before you create the
run the createuploadbat command? So then it would appear like this:

function
CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
'+alltrim(cIp)
strtofile(cBatString,cRptDir+'Upload.bat')
cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
'+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
strtofile(cScrString,cRptDir+'FtpRpt.scr')
return

CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
cCmd='c:\upload.bat'
run &cCmd

Thanks Ben!

"Ben" <nospam@nospam.com> wrote in message
news:hU1jf.118$f41.34@tornado.rdc-kc.rr.com...
> subfolder isn't needed. I just ran this and it worked.
>
> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
> cCmd='c:\upload.bat'
> run &cCmd
>
> you'll need to include this function.
>
> function
> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
> '+alltrim(cIp)
> strtofile(cBatString,cRptDir+'Upload.bat')
> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
> strtofile(cScrString,cRptDir+'FtpRpt.scr')
> return
>
>
>
> "Ben" <nospam@nospam.com> wrote in message
> news:Ny1jf.115$f41.25@tornado.rdc-kc.rr.com...
>> Give me 15 mins and I'll hook you up. BRB....
>>
>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>> news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
>>> ok, I took that 9out. Trying to get it to work and it appears to work in
>>> that I get no errors but the file doesn't upload and I don't see an
>>> upload.bat file on the C drive.
>>>
>>> I didn't specify a subfolder to upload to, is that needed?
>>>
>>> I changed the file to be uploaded (*.bat) in the CreateUploadBat line to
>>> be the actual txt filename that I need it to upload. Correct?
>>>
>>> Thanks Ben!
>>> Buster
>>>
>>> I did verify my ftp.exe is in the windows\system32 folder so I left that
>>> path in tact.
>>> "Ben" <nospam@nospam.com> wrote in message
>>> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>>>> Yep...but I noticed a mistake when I trimmed out custome code I left in
>>>> a reference to (cDefHtml) in the cCmd string, you can get rid of that.
>>>>
>>>> Been posting questions here a while, first time I think I've actually
>>>> answered one! hehe.
>>>>
>>>> - Ben
>>>>
>>>>
>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>>>> This may be the easiest thing to do then in all honesty. So once I get
>>>>> my output file, I can simply insert this code at the bottom of my
>>>>> already created program. Correct?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>>>> [my previous post had the cr and lf stripped]
>>>>>>
>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>>>> There are a few ways to tackle this. What I ended up doing was
>>>>>> creating a
>>>>>> func that writes a batch file calling the windows FTP command and
>>>>>> then run
>>>>>> it. May not be the best way but it's worked very reliably hundreds
>>>>>> of times
>>>>>> a day....
>>>>>>
>>>>>> Code looks something like this:
>>>>>>
>>>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>>>> run &cCmd
>>>>>>
>>>>>> ************************************************************************
>>>>>> function
>>>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>>>> return
>>>>>>
>>>>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>>>>> or\windows\system32 depending
>>>>>> *!* cRptDir=source file path
>>>>>> *!* cUploadDir=destination folder
>>>>>> *!* cUser=user name*!* cPw=pasword
>>>>>> *!* cIp=ip or dn to connect to
>>>>>> *!* cFileName=file to transfer (can include wildcards)
>>>>>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>>>>>> feedchr(13)+chr(10)
>>>>>>
>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 14:17:30 CST 2005

I store like functions in a single .prg file then do a

Set procedure to (cDefprog) + 'common.prg' additive

in the main.prg so it doesn't matter where the function sits in relation to
the call to that function.


"Bubba Gump Shrimp" <none@microsoft.com> wrote in message
news:e3UE95R9FHA.2576@TK2MSFTNGP12.phx.gbl...
> Shouldn't the function come first so it can be defined before you create
> the run the createuploadbat command? So then it would appear like this:
>
> function
> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
> '+alltrim(cIp)
> strtofile(cBatString,cRptDir+'Upload.bat')
> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
> strtofile(cScrString,cRptDir+'FtpRpt.scr')
> return
>
>
> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
> cCmd='c:\upload.bat'
> run &cCmd
>
> Thanks Ben!
>
> "Ben" <nospam@nospam.com> wrote in message
> news:hU1jf.118$f41.34@tornado.rdc-kc.rr.com...
>> subfolder isn't needed. I just ran this and it worked.
>>
>> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
>> cCmd='c:\upload.bat'
>> run &cCmd
>>
>> you'll need to include this function.
>>
>> function
>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
>> '+alltrim(cIp)
>> strtofile(cBatString,cRptDir+'Upload.bat')
>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
>> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>> return
>>
>>
>>
>> "Ben" <nospam@nospam.com> wrote in message
>> news:Ny1jf.115$f41.25@tornado.rdc-kc.rr.com...
>>> Give me 15 mins and I'll hook you up. BRB....
>>>
>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>> news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
>>>> ok, I took that 9out. Trying to get it to work and it appears to work
>>>> in that I get no errors but the file doesn't upload and I don't see an
>>>> upload.bat file on the C drive.
>>>>
>>>> I didn't specify a subfolder to upload to, is that needed?
>>>>
>>>> I changed the file to be uploaded (*.bat) in the CreateUploadBat line
>>>> to be the actual txt filename that I need it to upload. Correct?
>>>>
>>>> Thanks Ben!
>>>> Buster
>>>>
>>>> I did verify my ftp.exe is in the windows\system32 folder so I left
>>>> that path in tact.
>>>> "Ben" <nospam@nospam.com> wrote in message
>>>> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>>>>> Yep...but I noticed a mistake when I trimmed out custome code I left
>>>>> in a reference to (cDefHtml) in the cCmd string, you can get rid of
>>>>> that.
>>>>>
>>>>> Been posting questions here a while, first time I think I've actually
>>>>> answered one! hehe.
>>>>>
>>>>> - Ben
>>>>>
>>>>>
>>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>>>>> This may be the easiest thing to do then in all honesty. So once I
>>>>>> get my output file, I can simply insert this code at the bottom of my
>>>>>> already created program. Correct?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>>>>> [my previous post had the cr and lf stripped]
>>>>>>>
>>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>>>>> There are a few ways to tackle this. What I ended up doing was
>>>>>>> creating a
>>>>>>> func that writes a batch file calling the windows FTP command and
>>>>>>> then run
>>>>>>> it. May not be the best way but it's worked very reliably hundreds
>>>>>>> of times
>>>>>>> a day....
>>>>>>>
>>>>>>> Code looks something like this:
>>>>>>>
>>>>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>>>>> run &cCmd
>>>>>>>
>>>>>>> ************************************************************************
>>>>>>> function
>>>>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>>>>> return
>>>>>>>
>>>>>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>>>>>> or\windows\system32 depending
>>>>>>> *!* cRptDir=source file path
>>>>>>> *!* cUploadDir=destination folder
>>>>>>> *!* cUser=user name*!* cPw=pasword
>>>>>>> *!* cIp=ip or dn to connect to
>>>>>>> *!* cFileName=file to transfer (can include wildcards)
>>>>>>> *!* Note: the CrLf() funciton simply adds a carriage return and line
>>>>>>> feedchr(13)+chr(10)
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Bubba

Bubba
Tue Nov 29 15:31:33 CST 2005

Man I must be really stupid cuz I just can't make it work. If I put it all
at the bottom of my little simple program, how should it be constructed?

Also, if I'm using an ip address, does it need to have ftp:// in front of it
for it to work?

This is what i put at the end of my program and i get no transfer attempt.
(I've includede line numbers below at the start of each line to show what
all is on a single line in case something's wrong and word wrap here makes
it appear wrong.

1. function
CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
2.
cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
3. strtofile(cBatString,cRptDir+'Upload.bat')
4.
cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
'+cRptDir+cFileName+CrLf()+'quit'
5. strtofile(cScrString,cRptDir+'FtpRpt.scr')
6. RETURN

1. CreateUploadBat ('c:\windows\system32','directory where file to send
resides','','myuser','mypassword','ftp://ftpipaddress','file to send')
2. cCmd='c:\upload.bat'
3. run &cCmd\

It is not creating the batch file anywhere and it's not creating a
FtpRpt.scr anywhere.

Thanks for your patience.

Buster

"Ben" <nospam@nospam.com> wrote in message
news:uH2jf.69$1U2.57@tornado.rdc-kc.rr.com...
>I store like functions in a single .prg file then do a
>
> Set procedure to (cDefprog) + 'common.prg' additive
>
> in the main.prg so it doesn't matter where the function sits in relation
> to the call to that function.
>
>
> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
> news:e3UE95R9FHA.2576@TK2MSFTNGP12.phx.gbl...
>> Shouldn't the function come first so it can be defined before you create
>> the run the createuploadbat command? So then it would appear like this:
>>
>> function
>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
>> '+alltrim(cIp)
>> strtofile(cBatString,cRptDir+'Upload.bat')
>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
>> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>> return
>>
>>
>> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
>> cCmd='c:\upload.bat'
>> run &cCmd
>>
>> Thanks Ben!
>>
>> "Ben" <nospam@nospam.com> wrote in message
>> news:hU1jf.118$f41.34@tornado.rdc-kc.rr.com...
>>> subfolder isn't needed. I just ran this and it worked.
>>>
>>> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
>>> cCmd='c:\upload.bat'
>>> run &cCmd
>>>
>>> you'll need to include this function.
>>>
>>> function
>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
>>> '+alltrim(cIp)
>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
>>> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>> return
>>>
>>>
>>>
>>> "Ben" <nospam@nospam.com> wrote in message
>>> news:Ny1jf.115$f41.25@tornado.rdc-kc.rr.com...
>>>> Give me 15 mins and I'll hook you up. BRB....
>>>>
>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>> news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
>>>>> ok, I took that 9out. Trying to get it to work and it appears to work
>>>>> in that I get no errors but the file doesn't upload and I don't see an
>>>>> upload.bat file on the C drive.
>>>>>
>>>>> I didn't specify a subfolder to upload to, is that needed?
>>>>>
>>>>> I changed the file to be uploaded (*.bat) in the CreateUploadBat line
>>>>> to be the actual txt filename that I need it to upload. Correct?
>>>>>
>>>>> Thanks Ben!
>>>>> Buster
>>>>>
>>>>> I did verify my ftp.exe is in the windows\system32 folder so I left
>>>>> that path in tact.
>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>>>>>> Yep...but I noticed a mistake when I trimmed out custome code I left
>>>>>> in a reference to (cDefHtml) in the cCmd string, you can get rid of
>>>>>> that.
>>>>>>
>>>>>> Been posting questions here a while, first time I think I've actually
>>>>>> answered one! hehe.
>>>>>>
>>>>>> - Ben
>>>>>>
>>>>>>
>>>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>>>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>>>>>> This may be the easiest thing to do then in all honesty. So once I
>>>>>>> get my output file, I can simply insert this code at the bottom of
>>>>>>> my already created program. Correct?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>>>>>> [my previous post had the cr and lf stripped]
>>>>>>>>
>>>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>>>>>> There are a few ways to tackle this. What I ended up doing was
>>>>>>>> creating a
>>>>>>>> func that writes a batch file calling the windows FTP command and
>>>>>>>> then run
>>>>>>>> it. May not be the best way but it's worked very reliably hundreds
>>>>>>>> of times
>>>>>>>> a day....
>>>>>>>>
>>>>>>>> Code looks something like this:
>>>>>>>>
>>>>>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>>>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>>>>>> run &cCmd
>>>>>>>>
>>>>>>>> ************************************************************************
>>>>>>>> function
>>>>>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>>>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>>>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>>>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>>>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>>>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>>>>>> return
>>>>>>>>
>>>>>>>> *!* cFtpDir =where the ftp.exe sits on your PC, could be \windows
>>>>>>>> or\windows\system32 depending
>>>>>>>> *!* cRptDir=source file path
>>>>>>>> *!* cUploadDir=destination folder
>>>>>>>> *!* cUser=user name*!* cPw=pasword
>>>>>>>> *!* cIp=ip or dn to connect to
>>>>>>>> *!* cFileName=file to transfer (can include wildcards)
>>>>>>>> *!* Note: the CrLf() funciton simply adds a carriage return and
>>>>>>>> line feedchr(13)+chr(10)
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



Re: can VFP 9 ftp a file??? by Ben

Ben
Tue Nov 29 16:14:33 CST 2005

No problem and I don't think you're stupid man. Read some of my previous
posts LOL....

For kicks try putting the functon only in a separate .prg (ex: MyFuncs.prg)
then do this

1.) Set procedure to'c:\wherever\MyFuncs.Prg' additive

2.) CreateUploadBat
('c:\windows\system32','c:\','','myuser','mypassword','ftp://ftpipaddress','file
to send')

Then stop here, check to be sure the upload.bat and FtpRpt.Scr files are
created, if yes then add these lines:

3.) cCmd='c:\upload.bat'

4.) run &cCmd

If the .bat file is not created you might want to return a .t. or .f. from
CreateUploadBat(...) so you can see if was successfull. This can be
accomplished by setting a numeric variable on the StrToFile line.

Ex: nError=StrToFile((cScrString,cRptDir+'FtpRpt.scr')

if nError=0
return .f.
else
return .t.
endif


"Bubba Gump Shrimp" <none@microsoft.com> wrote in message
news:O7TWGxS9FHA.2844@TK2MSFTNGP10.phx.gbl...
> Man I must be really stupid cuz I just can't make it work. If I put it all
> at the bottom of my little simple program, how should it be constructed?
>
> Also, if I'm using an ip address, does it need to have ftp:// in front of
> it for it to work?
>
> This is what i put at the end of my program and i get no transfer attempt.
> (I've includede line numbers below at the start of each line to show what
> all is on a single line in case something's wrong and word wrap here makes
> it appear wrong.
>
> 1. function
> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
> 2.
> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
> 3. strtofile(cBatString,cRptDir+'Upload.bat')
> 4.
> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
> '+cRptDir+cFileName+CrLf()+'quit'
> 5. strtofile(cScrString,cRptDir+'FtpRpt.scr')
> 6. RETURN
>
> 1. CreateUploadBat ('c:\windows\system32','directory where file to send
> resides','','myuser','mypassword','ftp://ftpipaddress','file to send')
> 2. cCmd='c:\upload.bat'
> 3. run &cCmd\
>
> It is not creating the batch file anywhere and it's not creating a
> FtpRpt.scr anywhere.
>
> Thanks for your patience.
>
> Buster
>
> "Ben" <nospam@nospam.com> wrote in message
> news:uH2jf.69$1U2.57@tornado.rdc-kc.rr.com...
>>I store like functions in a single .prg file then do a
>>
>> Set procedure to (cDefprog) + 'common.prg' additive
>>
>> in the main.prg so it doesn't matter where the function sits in relation
>> to the call to that function.
>>
>>
>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>> news:e3UE95R9FHA.2576@TK2MSFTNGP12.phx.gbl...
>>> Shouldn't the function come first so it can be defined before you create
>>> the run the createuploadbat command? So then it would appear like this:
>>>
>>> function
>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
>>> '+alltrim(cIp)
>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
>>> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>> return
>>>
>>>
>>> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
>>> cCmd='c:\upload.bat'
>>> run &cCmd
>>>
>>> Thanks Ben!
>>>
>>> "Ben" <nospam@nospam.com> wrote in message
>>> news:hU1jf.118$f41.34@tornado.rdc-kc.rr.com...
>>>> subfolder isn't needed. I just ran this and it worked.
>>>>
>>>> CreateUploadBat('c:\windows\system32\','c:\','','ben','ben','www.ftp.com','autoexec.bat')
>>>> cCmd='c:\upload.bat'
>>>> run &cCmd
>>>>
>>>> you'll need to include this function.
>>>>
>>>> function
>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr
>>>> '+alltrim(cIp)
>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd
>>>> '+cUploadDir+CrLf()+'mput '+cRptDir+cFileName+CrLf()+'quit'
>>>> strtofile(cScrString,cRptDir+'FtpRpt.scr')
>>>> return
>>>>
>>>>
>>>>
>>>> "Ben" <nospam@nospam.com> wrote in message
>>>> news:Ny1jf.115$f41.25@tornado.rdc-kc.rr.com...
>>>>> Give me 15 mins and I'll hook you up. BRB....
>>>>>
>>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>>> news:u6VMyMR9FHA.1148@tk2msftngp13.phx.gbl...
>>>>>> ok, I took that 9out. Trying to get it to work and it appears to work
>>>>>> in that I get no errors but the file doesn't upload and I don't see
>>>>>> an upload.bat file on the C drive.
>>>>>>
>>>>>> I didn't specify a subfolder to upload to, is that needed?
>>>>>>
>>>>>> I changed the file to be uploaded (*.bat) in the CreateUploadBat line
>>>>>> to be the actual txt filename that I need it to upload. Correct?
>>>>>>
>>>>>> Thanks Ben!
>>>>>> Buster
>>>>>>
>>>>>> I did verify my ftp.exe is in the windows\system32 folder so I left
>>>>>> that path in tact.
>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>> news:VX0jf.110$f41.3@tornado.rdc-kc.rr.com...
>>>>>>> Yep...but I noticed a mistake when I trimmed out custome code I left
>>>>>>> in a reference to (cDefHtml) in the cCmd string, you can get rid of
>>>>>>> that.
>>>>>>>
>>>>>>> Been posting questions here a while, first time I think I've
>>>>>>> actually answered one! hehe.
>>>>>>>
>>>>>>> - Ben
>>>>>>>
>>>>>>>
>>>>>>> "Bubba Gump Shrimp" <none@microsoft.com> wrote in message
>>>>>>> news:uAR5h$Q9FHA.3876@TK2MSFTNGP09.phx.gbl...
>>>>>>>> This may be the easiest thing to do then in all honesty. So once I
>>>>>>>> get my output file, I can simply insert this code at the bottom of
>>>>>>>> my already created program. Correct?
>>>>>>>>
>>>>>>>> Thanks!
>>>>>>>>
>>>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>>>> news:LH0jf.96$Dk.69@tornado.rdc-kc.rr.com...
>>>>>>>>> [my previous post had the cr and lf stripped]
>>>>>>>>>
>>>>>>>>> "Ben" <nospam@nospam.com> wrote in message
>>>>>>>>> news:5D0jf.95$Dk.1@tornado.rdc-kc.rr.com...
>>>>>>>>> There are a few ways to tackle this. What I ended up doing was
>>>>>>>>> creating a
>>>>>>>>> func that writes a batch file calling the windows FTP command and
>>>>>>>>> then run
>>>>>>>>> it. May not be the best way but it's worked very reliably
>>>>>>>>> hundreds of times
>>>>>>>>> a day....
>>>>>>>>>
>>>>>>>>> Code looks something like this:
>>>>>>>>>
>>>>>>>>> CreateUploadBat('c:\windows\system32','c:\','SubFolder/','user','password','111.222.333.444','*.bat')
>>>>>>>>> cCmd=(cDefhtml)+'c:\Upload.bat'
>>>>>>>>> run &cCmd
>>>>>>>>>
>>>>>>>>> ************************************************************************
>>>>>>>>> function
>>>>>>>>> CreateUploadBat(cFtpDir,cRptDir,cUploadDir,cUser,cPw,cIp,cFileName)
>>>>>>>>> cBatString=alltrim(cFtpDir)+'ftp -i -n -s:'+cRptDir+'FtpRpt.scr'+alltrim(cIp)
>>>>>>>>> strtofile(cBatString,cRptDir+'Upload.bat')
>>>>>>>>> cScrString='user'+CrLf()+cUser+CrLf()+cPw+CrLf()+'cd'+cUploadDir+CrLf()+'mput
>>>>>>>>> '+cRptDir+cFileName+CrLf()+'quit'
>>>>>>>>> strtofile(cScrSt