PROBLEME DE FTP

cs_croatia Messages postés 2 Date d'inscription lundi 12 mai 2003 Statut Membre Dernière intervention 14 mai 2003 - 14 mai 2003 à 11:16
cs_croatia Messages postés 2 Date d'inscription lundi 12 mai 2003 Statut Membre Dernière intervention 14 mai 2003 - 14 mai 2003 à 11:17
Bonjour à tous j'ai un problème avec mon programme d'upload FTP celui ci crée bien le fichier mais il est vide!!!
J'aimerai donc savoir si qq1 à une idée qui pourrai me sortir de cette impasse !!!!

Merci

Private Sub Command1_Click()
Dim taille As Variant
Dim pourcent As Integer
Dim fic_source, fic_destination As String

fic_source = "C:\test.txt" 'fichier a uploader"
fic_destination = "test.txt" 'fichier de destination"
pb.Min = 0
pb.Max = FileLen(fic_source)
With Inet1
.Protocol = icFTP 'declaration protocole
.URL = "ftp://serveur.dyndns.org" 'le ftp
.UserName = "log"
.Password = "pass"
.RemotePort = 1980
.RequestTimeout = 40
End With

'Inet1.Execute "PUT " & fic_source & "/" & fic_destination 'envoie du fichier

'Inet1.Execute , "PUT C:\test1.txt /test1.txt"
'Inet1.Execute , "PUT C:\Systray.exe /test.exe"
If Not Inet1.StillExecuting Then
Inet1.Execute , "SEND " & fic_source & " " & fic_destination

End If

'Inet2.URL = Inet1.URL 'initialise inet2 : mm url

'Do Until Inet1.StillExecuting = False 'boucle pendant le traitement de inet1
'On Error Resume Next
' If Inet2.StillExecuting = False Then 'si inet2 n'est pas actif

' Inet2.Execute , "size /" & fic_destination 'demande la taille du fichier sur le ftp
'Do Until Inet2.StillExecuting = False 'boucle pendant le demande inet2
' DoEvents
' Loop

' taille = Inet2.GetChunk(1024) 'recuperation du size dans taille
' Do Until Inet2.StillExecuting = False 'boucle pendant le demande inet2
'DoEvents
' Loop

'affichage de la progressbar

'pb.Value = taille 'affichage de l'avancement de pb
'pourcent = (pb.Value / pb.Max) * 100 'calcul du pourcentage reçu
' Label1.Caption = pourcent & "%" 'affichage du % du telechargement

' End If
'Loop
End Sub

Private Sub Command2_Click()
Inet1.Execute , "close"
End Sub

1 réponse

cs_croatia Messages postés 2 Date d'inscription lundi 12 mai 2003 Statut Membre Dernière intervention 14 mai 2003
14 mai 2003 à 11:17
-------------------------------
Réponse au message :
-------------------------------

> Bonjour à tous j'ai un problème avec mon programme d'upload FTP celui ci crée bien le fichier mais il est vide!!!
> J'aimerai donc savoir si qq1 à une idée qui pourrai me sortir de cette impasse !!!!
>
> Merci
>
>
> Private Sub Command1_Click()
> Dim taille As Variant
> Dim pourcent As Integer
> Dim fic_source, fic_destination As String
>
> fic_source = "C:\test.txt" 'fichier a uploader"
> fic_destination = "test.txt" 'fichier de destination"
> pb.Min = 0
> pb.Max = FileLen(fic_source)
> With Inet1
> .Protocol = icFTP 'declaration protocole
> .URL = "ftp://serveur.dyndns.org" 'le ftp
> .UserName = "log"
> .Password = "pass"
> .RemotePort = 1980
> .RequestTimeout = 40
> End With
>
> 'Inet1.Execute "PUT " & fic_source & "/" & fic_destination 'envoie du fichier
>
> 'Inet1.Execute , "PUT C:\test1.txt /test1.txt"
> 'Inet1.Execute , "PUT C:\Systray.exe /test.exe"
> If Not Inet1.StillExecuting Then
> Inet1.Execute , "SEND " & fic_source & " " & fic_destination
>
> End If
>
> 'Inet2.URL = Inet1.URL 'initialise inet2 : mm url
>
> 'Do Until Inet1.StillExecuting = False 'boucle pendant le traitement de inet1
> 'On Error Resume Next
> ' If Inet2.StillExecuting = False Then 'si inet2 n'est pas actif
>
> ' Inet2.Execute , "size /" & fic_destination 'demande la taille du fichier sur le ftp
> 'Do Until Inet2.StillExecuting = False 'boucle pendant le demande inet2
> ' DoEvents
> ' Loop
>
> ' taille = Inet2.GetChunk(1024) 'recuperation du size dans taille
> ' Do Until Inet2.StillExecuting = False 'boucle pendant le demande inet2
> 'DoEvents
> ' Loop
>
> 'affichage de la progressbar
>
> 'pb.Value = taille 'affichage de l'avancement de pb
> 'pourcent = (pb.Value / pb.Max) * 100 'calcul du pourcentage reçu
> ' Label1.Caption = pourcent & "%" 'affichage du % du telechargement
>
> ' End If
> 'Loop
> End Sub
>
> Private Sub Command2_Click()
> Inet1.Execute , "close"
> End Sub
>
0
Rejoignez-nous