Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ftp
Message
De
01/12/2020 14:59:41
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Contrôles ActiveX en VFP
Titre:
Ftp
Divers
Thread ID:
01677379
Message ID:
01677379
Vues:
57
Respected Seniors

I refer to this link

https://social.msdn.microsoft.com/Forums/en-US/26c385e6-fa9c-4bb2-8f59-bde32cbe0a31/vfp-6-upload-of-file-to-remote-filesystem?forum=visualfoxprogeneral

I am using codes by Stefan Förner, at the bottom of page

I am trying to upload file on ftp server

I dropped Microsoft Internet Transfer control and put these codes under a command button
WITH THISFORM.OleControl1        && ajust the name OleControl1 if necessary !!!
    .URL = "https://onedrive.live.com/?id=root&cid=DD134DEA9ECW50DE"
    .UserName = "myhouse@hotmail.com"
    .PassWord = "a123456"
    .Protocol = 2                             && 2 = FTP protocol
    .RequestTimeOut = 10              && time out in seconds

    _VFP.AutoYield = .F.

    DO WHILE .StillExecuting
        DOEVENTS
    ENDDO

    _VFP.AutoYield = .T.

    IF .ResponseCode != 0
        MESSAGEBOX( "FTP-Error: " + ALLTRIM( STR( .ResponseCode ) ) + " - " + .ResponseInfo )
    ENDIF
ENDWITH
*---------------------------------------------------------------------
WITH THISFORM.OleControl1
    srcFile = "c:\xls\daily.xlsx"        && local source file
    desFile = "daily.xlsx"       && remote destination file

    .Execute( , "PUT " + srcFile + " " + desFile)

    _VFP.AutoYield = .F.

    DO WHILE .StillExecuting
        DOEVENTS
    ENDDO

    _VFP.AutoYield = .T.

    IF .ResponseCode != 0
        MESSAGEBOX( "FTP-Error: " + ALLTRIM( STR( .ResponseCode ) ) + " - " + .ResponseInfo )
    ENDIF
ENDWITH
*----------------------------------------------------------------------------------------
WITH THISFORM.OleControl1
    .Execute( , "CLOSE" )

    _VFP.AutoYield = .F.

    DO WHILE .StillExecuting
        DOEVENTS
    ENDDO

    _VFP.AutoYield = .T.

    IF .ResponseCode != 0
        MESSAGEBOX( "FTP-Error: " + ALLTRIM( STR( .ResponseCode ) ) + " - " + .ResponseInfo )
    ENDIF
ENDWITH
When I run above codes the it show error message
OLE IDispatch exception code 0 from Inet: Request timed out..
and the line on error occurs is
 .Execute( , "PUT " + srcFile + " " + desFile)
Could some one please me what I am doing wrong.

Or is there any other way to upload file to onedrive.

Regards
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform