TariqMehmod
Programmer
I refer to this link
[link] [/url]
Where I am trying codes of sir DSummZZZ
I have following codes with my following parameter
lcHost ,lcUser ,lcPassword,lcSource ,lcTarget
When I run codes then it says
ftp onedrive.live.com is not available
Please help me to upload file to onedrive.
Regards
[link] [/url]
Where I am trying codes of sir DSummZZZ
I have following codes with my following parameter
lcHost ,lcUser ,lcPassword,lcSource ,lcTarget
Code:
*... ftpPut.prg ...
PARAMETERS lcHost, lcUser, lcPassword, lcSource, lcTarget
*... Usage: DO ftpput WITH ;
*... 'ftp.host', 'name', 'password', 'source.file', 'target.file'
#DEFINE XFER_ASCII 1
#DEFINE XFER_BINARY 2
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
PUBLIC hOpen, hftpSession
lcHost = ALLTRIM('onedrive.live.com')
lcUser = ALLTRIM('myemail@hotmail.com')
lcPassword = ALLTRIM('abc123456')
lcSource = ALLTRIM('c:\xls\daily.xlsx')
lcTarget = ALLTRIM('test')
IF connect2ftp (lcHost, lcUser, lcPassword)
IF ftpPutFile (hftpSession, lcSource,;
lcTarget, XFER_ASCII, 0) = 1
?'File transferred.'
ENDIF
= InternetCloseHandle (hftpSession)
= InternetCloseHandle (hOpen)
ENDIF
FUNCTION connect2ftp (strHost, strUser, strPwd)
hOpen = InternetOpen ("vfp", 1, 0, 0, 0)
IF hOpen = 0
? "Unable to get access to WinInet.Dll"
RETURN .F.
ENDIF
hftpSession = InternetConnect (hOpen, strHost, 0,;
strUser, strPwd, 1, 0, 0) &&... 1 = ftp
IF hftpSession = 0
* close Inet and exit
= InternetCloseHandle (hOpen)
? "ftp " + strHost + " is not available"
RETURN .F.
ELSE
? "Connected to " + strHost
ENDIF
RETURN .T.
When I run codes then it says
ftp onedrive.live.com is not available
Please help me to upload file to onedrive.
Regards