J'aimerais developp=E9 dans mon programme un petit programme qui me
permetrait de me connecter =E0 un serveur ftp et de t=E9l=E9charger un de
ces fichiers.
Quelqu'un peut t'il m'aider ?
J'ai entendu parler du component Inet mais on m'as dit qu'il y avait un
bug...
Je veux simplement me connecter a un serveur ftp et telecharger un
fichier texte que je dois reutiliser dans une listbox.
Et ma deuxieme =E9tape serait de transferer un fichier de 500 Mo sur
celui ci.
On ma di que les serveur ftp =E9tait fait pour cela est que leur
stabilit=E9 =E9tait excellenete et qu'il existait surement des API pour
effectuer toutes mes transaction mais je ne les trouve pas...
Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Guy DETIENNE
Salut ;O)
Inspire-toi du code ci-dessous à coller 'bêtement' dans un formulaire et à adapter selon tes besoins : Ou va ici : http://www.allapi.net/apilist/FtpGetFile.shtml Tu auras le même exemple que le code ci-dessous.
Guy Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const FTP_TRANSFER_TYPE_BINARY = &H2
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
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS
Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
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 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 Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
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 InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Const PassiveConnection As Boolean = True
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net
'E-Mail:
Dim hConnection As Long, hOpen As Long, sOrgPath As String
J'aimerais developpé dans mon programme un petit programme qui me permetrait de me connecter à un serveur ftp et de télécharger un de ces fichiers.
Quelqu'un peut t'il m'aider ?
J'ai entendu parler du component Inet mais on m'as dit qu'il y avait un bug...
Je veux simplement me connecter a un serveur ftp et telecharger un fichier texte que je dois reutiliser dans une listbox. Et ma deuxieme étape serait de transferer un fichier de 500 Mo sur celui ci.
On ma di que les serveur ftp était fait pour cela est que leur stabilité était excellenete et qu'il existait surement des API pour effectuer toutes mes transaction mais je ne les trouve pas...
Merci de votre aide !
Johnson
Salut ;O)
Inspire-toi du code ci-dessous à coller 'bêtement' dans un formulaire et à
adapter selon tes besoins :
Ou va ici : http://www.allapi.net/apilist/FtpGetFile.shtml
Tu auras le même exemple que le code ci-dessous.
Guy
Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const FTP_TRANSFER_TYPE_BINARY = &H2
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
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using
java/script/INS
Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
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 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 Declare Function FtpCreateDirectory Lib "wininet.dll" Alias
"FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As
String) As Boolean
Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias
"FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As
String) As Boolean
Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias
"FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String)
As Boolean
Private Declare Function FtpRenameFile Lib "wininet.dll" Alias
"FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String,
ByVal lpszNew As String) As Boolean
Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA"
(ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile
As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long,
ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
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 InternetGetLastResponseInfo Lib "wininet.dll" Alias
"InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As
String, lpdwBufferLength As Long) As Boolean
Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias
"FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As
String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal
dwContent As Long) As Long
Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias
"InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As
WIN32_FIND_DATA) As Long
Const PassiveConnection As Boolean = True
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net
'E-Mail: KPDTeam@allapi.net
Dim hConnection As Long, hOpen As Long, sOrgPath As String
<john.ambou@free.fr> a écrit dans le message de news:
1159214626.357943.145870@k70g2000cwa.googlegroups.com...
Bonjour ,
J'aimerais developpé dans mon programme un petit programme qui me
permetrait de me connecter à un serveur ftp et de télécharger un de
ces fichiers.
Quelqu'un peut t'il m'aider ?
J'ai entendu parler du component Inet mais on m'as dit qu'il y avait un
bug...
Je veux simplement me connecter a un serveur ftp et telecharger un
fichier texte que je dois reutiliser dans une listbox.
Et ma deuxieme étape serait de transferer un fichier de 500 Mo sur
celui ci.
On ma di que les serveur ftp était fait pour cela est que leur
stabilité était excellenete et qu'il existait surement des API pour
effectuer toutes mes transaction mais je ne les trouve pas...
Inspire-toi du code ci-dessous à coller 'bêtement' dans un formulaire et à adapter selon tes besoins : Ou va ici : http://www.allapi.net/apilist/FtpGetFile.shtml Tu auras le même exemple que le code ci-dessous.
Guy Const FTP_TRANSFER_TYPE_UNKNOWN = &H0
Const FTP_TRANSFER_TYPE_ASCII = &H1
Const FTP_TRANSFER_TYPE_BINARY = &H2
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
Const INTERNET_OPEN_TYPE_DIRECT = 1 ' direct to net
Const INTERNET_OPEN_TYPE_PROXY = 3 ' via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4 ' prevent using java/script/INS
Const MAX_PATH = 260
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type WIN32_FIND_DATA
dwFileAttributes As Long
ftCreationTime As FILETIME
ftLastAccessTime As FILETIME
ftLastWriteTime As FILETIME
nFileSizeHigh As Long
nFileSizeLow As Long
dwReserved0 As Long
dwReserved1 As Long
cFileName As String * MAX_PATH
cAlternate As String * 14
End Type
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 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 Declare Function FtpCreateDirectory Lib "wininet.dll" Alias "FtpCreateDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpRemoveDirectory Lib "wininet.dll" Alias "FtpRemoveDirectoryA" (ByVal hFtpSession As Long, ByVal lpszDirectory As String) As Boolean
Private Declare Function FtpDeleteFile Lib "wininet.dll" Alias "FtpDeleteFileA" (ByVal hFtpSession As Long, ByVal lpszFileName As String) As Boolean
Private Declare Function FtpRenameFile Lib "wininet.dll" Alias "FtpRenameFileA" (ByVal hFtpSession As Long, ByVal lpszExisting As String, ByVal lpszNew As String) As Boolean
Private Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" (ByVal hConnect As Long, ByVal lpszRemoteFile As String, ByVal lpszNewFile As String, ByVal fFailIfExists As Long, ByVal dwFlagsAndAttributes As Long, ByVal dwFlags As Long, ByRef dwContext As Long) As Boolean
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 InternetGetLastResponseInfo Lib "wininet.dll" Alias "InternetGetLastResponseInfoA" (lpdwError As Long, ByVal lpszBuffer As String, lpdwBufferLength As Long) As Boolean
Private Declare Function FtpFindFirstFile Lib "wininet.dll" Alias "FtpFindFirstFileA" (ByVal hFtpSession As Long, ByVal lpszSearchFile As String, lpFindFileData As WIN32_FIND_DATA, ByVal dwFlags As Long, ByVal dwContent As Long) As Long
Private Declare Function InternetFindNextFile Lib "wininet.dll" Alias "InternetFindNextFileA" (ByVal hFind As Long, lpvFindData As WIN32_FIND_DATA) As Long
Const PassiveConnection As Boolean = True
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net
'E-Mail:
Dim hConnection As Long, hOpen As Long, sOrgPath As String
J'aimerais developpé dans mon programme un petit programme qui me permetrait de me connecter à un serveur ftp et de télécharger un de ces fichiers.
Quelqu'un peut t'il m'aider ?
J'ai entendu parler du component Inet mais on m'as dit qu'il y avait un bug...
Je veux simplement me connecter a un serveur ftp et telecharger un fichier texte que je dois reutiliser dans une listbox. Et ma deuxieme étape serait de transferer un fichier de 500 Mo sur celui ci.
On ma di que les serveur ftp était fait pour cela est que leur stabilité était excellenete et qu'il existait surement des API pour effectuer toutes mes transaction mais je ne les trouve pas...
Merci de votre aide !
Johnson
john.ambou
Merci beacoup 'c'est exactement ce qu'il me fallait :)
Mais maintenant j'ai un autre probleme ...
J'arrive pas a ma connecter sur mon serveur local ftp...
J'utilise donc internetopen qui me donne comme valeur de retour 133.... puis ensuite la fonction internetConnect mais celle ci me retourne toujours 0 je ne comprend pas pourquoi...
j'ai pourtant inseré 127.0.0.1 pour l'adresse IP et mes identifiants son corrects...
Pour vérifier si mon serveur est opérationnel je suis passer par l'invité de commande et j'arrive a me loguer msi pas moyen de me loguer avec les fonctions...
Ya t'il quelque chose de spécial a faire ??
Merci de votre aide Johnson
Merci beacoup 'c'est exactement ce qu'il me fallait :)
Mais maintenant j'ai un autre probleme ...
J'arrive pas a ma connecter sur mon serveur local ftp...
J'utilise donc internetopen qui me donne comme valeur de retour 133....
puis ensuite la fonction internetConnect mais celle ci me retourne
toujours 0 je ne comprend pas pourquoi...
j'ai pourtant inseré 127.0.0.1 pour l'adresse IP et mes identifiants
son corrects...
Pour vérifier si mon serveur est opérationnel je suis passer par
l'invité de commande et j'arrive a me loguer msi pas moyen de me
loguer avec les fonctions...
Merci beacoup 'c'est exactement ce qu'il me fallait :)
Mais maintenant j'ai un autre probleme ...
J'arrive pas a ma connecter sur mon serveur local ftp...
J'utilise donc internetopen qui me donne comme valeur de retour 133.... puis ensuite la fonction internetConnect mais celle ci me retourne toujours 0 je ne comprend pas pourquoi...
j'ai pourtant inseré 127.0.0.1 pour l'adresse IP et mes identifiants son corrects...
Pour vérifier si mon serveur est opérationnel je suis passer par l'invité de commande et j'arrive a me loguer msi pas moyen de me loguer avec les fonctions...