Function upload n'upload pas

papipsycho Messages postés 45 Date d'inscription samedi 24 mai 2003 Statut Membre Dernière intervention 1 janvier 2008 - 25 mars 2005 à 14:43
papipsycho Messages postés 45 Date d'inscription samedi 24 mai 2003 Statut Membre Dernière intervention 1 janvier 2008 - 25 mars 2005 à 19:12
voila j'ai m'a fonction FtpGetFile qui ne marche pas sa ne veux pas
uploader saver vous pourquoi cette fonction doi marcher car je les
recup sur une srouce





voila la fonction



Public Declare Function FtpGetFile Lib "wininet.dll" Alias "FtpGetFileA" _

(ByVal hFtpSession As Long, ByVal lpszRemoteFile As String, _

ByVal lpszNewFile As String, ByVal
fFailIfExists As Boolean, ByVal dwFlagsAndAttributes As Long, _

ByVal dwFlags As Long, ByVal dwContext As Long) As Boolean





voila le code





Session = InternetOpen("Compagnion", INTERNET_OPEN_TYPE_DIRECT, "", "", INTERNET_FLAG_NO_CACHE_WRITE)

If Session <> 0 Then

server = InternetConnect(Session, Host1(n), "21",
"anonymous", "user@server.com", INTERNET_SERVICE_FTP,
INTERNET_FLAG_EXISTING_CONNECT, &H0)

If server = 0 Then

Set itmx = ListView1.ListItems.Add(, , "bad")

itmx.SubItems(1) = Host1(n)

InternetCloseHandle Session



Else

Set itmx = ListView1.ListItems.Add(, , "Done")

itmx.SubItems(1) = Host1(n)

bRet = FtpGetFile(server, taille1, taille1 & directory2_ & taille1, False, _

INTERNET_FLAG_RELOAD, FTP_TRANSFER_TYPE_ASCII, 0)



If bRet = False Then

itmx.SubItems(4) = directory2_

itmx.SubItems(5) = "No"

itmx.SubItems(13) = os2_

itmx.SubItems(14) = res2_

Else

itmx.SubItems(4) = directory2_

itmx.SubItems(5) = "Yes"

itmx.SubItems(13) = os2_

itmx.SubItems(14) = res2_

End If







End If

--==Papi Psycho==--

3 réponses

papipsycho Messages postés 45 Date d'inscription samedi 24 mai 2003 Statut Membre Dernière intervention 1 janvier 2008
25 mars 2005 à 14:44
a oui javai oublier de dire sa se connect bien au serveur

--==Papi Psycho==--
0
cs_DARKSIDIOUS Messages postés 15814 Date d'inscription jeudi 8 août 2002 Statut Membre Dernière intervention 4 mars 2013 130
25 mars 2005 à 16:18
taille1 & directory2_ & taille1, c'est un nom de fichier valide ?


Vérifie également si tu te trouve dans le bon dossier !


DarK Sidious

Un API Viewer (pour le VB, VB.NET, C, C# et Delphi) : www.ProgOtoP.com/popapi/
0
papipsycho Messages postés 45 Date d'inscription samedi 24 mai 2003 Statut Membre Dernière intervention 1 janvier 2008
25 mars 2005 à 19:12
moi je pense que c bon voila tout le code



Private Sub Image1_Click()

Arret = True



CommonDialog1.DialogTitle = "Ouvrire"

CommonDialog1.Flags = cdlOFNFileMustExist + cdlOFNHelpButton

CommonDialog1.Filter = "Fichier log (*.log)|*.log"

CommonDialog1.ShowOpen



If CommonDialog1.FileName <> "" Then 'annuler



Image2.Enabled = 1

Stop1.Enabled = 1





Dim Host1() As String

Dim temp As String

Dim i As Integer

Dim n As Integer

Dim bRet As Boolean



Open "Compagnion.ini" For Input As #1

For i = 1 To 6

Input #1, upload1

Next i

Close

z$ = upload1

upload1_ = Mid$(z$, InStrRev(z$, "=") + 1)

If upload1_ = "1Mo" Then

taille1 = "1mo.up"

Else

taille1 = "1ko.up"

End If



Open CommonDialog1.FileName For Input As #1





Do While Not EOF(1)

If Arret = False Then

Exit Do

End If



n = n + 1

ReDim Preserve Host1(n)

Line Input #1, Host1(n)

Line Input #1, rien1

Line Input #1, directory1

Line Input #1, del1

Line Input #1, os1

Line Input #1, res1





directory1_ = Mid$(directory1, InStrRev(directory1, ":") + 1)

directory2_ = Mid$(directory1_, InStrRev(directory1_, " ") + 1)



res1_ = Mid$(res1, InStrRev(res1, ":") + 1)

res2_ = Mid$(res1_, InStrRev(res1_, " ") + 1)



os1_ = Mid$(os1, InStrRev(os1, ":") + 1)

os2_ = Mid$(os1_, InStrRev(os1_, " ") + 1)



Session = InternetOpen("Compagnion", INTERNET_OPEN_TYPE_DIRECT, "", "", INTERNET_FLAG_NO_CACHE_WRITE)

If Session <> 0 Then

server = InternetConnect(Session, Host1(n), "21",
"anonymous", "user@server.com", INTERNET_SERVICE_FTP,
INTERNET_FLAG_EXISTING_CONNECT, &H0)

If server = 0 Then

Set itmx = ListView1.ListItems.Add(, , "bad")

itmx.SubItems(1) = Host1(n)

InternetCloseHandle Session



Else

Set itmx = ListView1.ListItems.Add(, , "Done")

itmx.SubItems(1) = Host1(n)

bRet = FtpGetFile(server, taille1, taille1 & directory2_ & taille1, False, _

INTERNET_FLAG_RELOAD, FTP_TRANSFER_TYPE_ASCII, 0)



If bRet = False Then

itmx.SubItems(4) = directory2_

itmx.SubItems(5) = "No"

itmx.SubItems(13) = os2_

itmx.SubItems(14) = res2_

Else

itmx.SubItems(4) = directory2_

itmx.SubItems(5) = "Yes"

itmx.SubItems(13) = os2_

itmx.SubItems(14) = res2_

End If







End If

End If



For i = 1 To 2: Line Input #1, temp: Next



DoEvents





Loop

Close #1



End If

End Sub


--==Papi Psycho==--
0
Rejoignez-nous