ATOUTFOX
COMMUNAUTÉ FRANCOPHONE DES PROFESSIONNELS FOXPRO
Visual FoxPro : le développement durable

Forum AtoutFox : Re: Taille des fichiers envoyés par FTP   

Sujet

rss Flux RSS des derniers messages

Vous devez vous identifier pour pouvoir poser une question ou répondre.

mar. 05 août 2014, 11h18
etobis
France France

atoutfox.public.association

Re: Taille des fichiers envoyés par FTP

Le code :

LPARAMETERS p_local ,p_remote,_success,_retour,_totalWritten

LOCAL _h,_taille,h_ftp

&& fichier Local de taille nulle ?

_h = FOPEN(p_local)
_taille= FSEEK(_h, 0, 2)
IF _taille<= 0
this.console_add("Ce fichier est vide")
RETURN
ENDIF
= FCLOSE(_h)

&& reconnexion
this.ftp_close()
this.ftp_connect(this.ftp_host,this.ftp_user,this.ftp_password,this.ftp_passive_mode,this.ftp_port_number)

#DEFINE GENERIC_WRITE 1073741824 && &H40000000
#DEFINE FTPBUFSIZ_PUT (32*1024)

this.ftp_transfert_type=1
h_ftp=FtpOpenFile(this.ftp_hftpsession, p_remote, GENERIC_WRITE, this.ftp_transfert_type,0)

&& Ouverture du fichier local
_h = FOPEN(p_local)

&& Envoi
m.BytesWritten = 0
this.console_add("Envoi du fichier "+p_remote+" vers " +p_local)

m._success = .t.
m.BytesRead = 0
m._totalWritten=0

DO WHILE !feof(m._h) and m._success
IF (this.oform.stop_process)
IF (_h>0)
FCLOSE(_h)
ENDIF

IF (m.h_ftp>0)
=InternetCloseHandle(m.h_ftp)
ENDIF
RETURN
ENDIF

buf = fread(m._h, FTPBUFSIZ_PUT)
_retour=InternetWriteFile(m.h_ftp, @m.buf, len(m.buf), @m.BytesWritten)
IF EMPTY(m.BytesWritten)
_success = .f.
ELSE
m._totalWritten = m._totalWritten + m.BytesWritten
this.refprogressbar.maj(m._totalWritten,;
m._taille)

this.console_add(ALLTRIM(STR(m._totalWritten))+","+ALLTRIM(STR(m._taille)))
ENDIF
ENDDO

&& Fin
IF (_h>0)
FCLOSE(_h)
ENDIF

IF (m.h_ftp>0)
=InternetCloseHandle(m.h_ftp)
ENDIF

this.refprogressbar.maj(-1,-1)

this.ftp_close()

return m._success

Eto

Permalink : http://www.atoutfox.org/nntp.asp?ID=0000014912
20 286 messages dans le forum • Liste complète des messages

www.atoutfox.org - Site de la Communauté Francophone des Professionnels FoxPro - v3.4.0 - © 2004-2026.
Cette page est générée par un composant COM+ développé en Visual FoxPro 9.0-SP2-HF3