Peut-on vraiment envoyé un fichier sur un ftp?

Signaler
Messages postés
144
Date d'inscription
samedi 21 octobre 2000
Statut
Membre
Dernière intervention
7 mai 2009
-
Messages postés
144
Date d'inscription
samedi 21 octobre 2000
Statut
Membre
Dernière intervention
7 mai 2009
-
j'ais fait tout les source ki parle de sa sur VBfrance et ya rien ki marche!
quelqu'un pe m'aider?
Tuizi
A voir également:

2 réponses

Messages postés
22
Date d'inscription
mercredi 4 octobre 2000
Statut
Membre
Dernière intervention
31 janvier 2011

salut essaye ca
Option Explicit
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const INTERNET_DEFAULT_FTP_PORT = 21 ' default for FTP servers
Const INTERNET_SERVICE_FTP = 1
Const INTERNET_FLAG_PASSIVE = &H8000000 ' used for FTP connections
Const INTERNET_OPEN_TYPE_PRECONFIG = 0 ' use registry configuration

Private Declare Function InternetCloseHandle Lib "wininet.dll" (ByVal hInet As Long) As Integer
Private Declare Function InternetConnect Lib "wininet.dll" Alias "InternetConnectA" (ByVal hInternetSession As Long, ByVal sServerName As String, ByVal nServerPort As Integer, ByVal sUserName As String, ByVal sPassword As String, ByVal lService As Long, ByVal lFlags As Long, ByVal lContext As Long) As Long
Private Declare Function InternetOpen Lib "wininet.dll" Alias "InternetOpenA" (ByVal sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function FtpPutFile Lib "wininet.dll" Alias "FtpPutFileA" (ByVal hConnect As Long, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String, ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean
Private Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias "FtpSetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias "FtpGetCurrentDirectoryA" (ByVal hFtpSession As Long, ByVal lpszCurrentDirectory As String, lpdwCurrentDirectory As Long) As Long

Private Sub Forme()
Dim hopen As Long, hConnection As Long, toto As String
hopen = InternetOpen("SERVEUR ftp", INTERNET_OPEN_TYPE_PRECONFIG, vbNullString, vbNullString, 0)
hConnection = InternetConnect(hopen, "SERVEUR ftp", INTERNET_DEFAULT_FTP_PORT, "USERID", "PASSWORD", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
toto = String(260, 0)

FtpSetCurrentDirectory hConnection, "/data/ONYX/GEAE/OUT/INFO3SNS"
FtpGetCurrentDirectory hConnection, toto, Len(toto)
' fichier sur local nom fichier sur FTP
FtpPutFile hConnection, "C:\transfert\s12.txt", "s12.txt", FTP_TRANSFER_TYPE_ASCII, 0
'close the FTP connection
InternetCloseHandle hConnection

End Sub
0
Messages postés
144
Date d'inscription
samedi 21 octobre 2000
Statut
Membre
Dernière intervention
7 mai 2009

merci
Tuizi
0