Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to get size of an FTP file?
Message
De
23/03/2004 11:50:34
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00888903
Message ID:
00888913
Vues:
38
>How to get size of an FTP file?
>I wan to dispaly a prograss bar durig the download.
>TIA

Borislav,
Assuming you already know the APIs :
	pData = space(1024)
	hFind = FtpFindFirstFile(.hConnection, "*.*", @pData, 0, 0)
	If hFind = 0
		If (GetLastError() = ERROR_NO_MORE_FILES)
			.FTPResponse("Remote directory is empty!")
		Else
			.FTPResponse("FtpFindFirstFile error")
		Endif
		Return
	Endif
	.ListDirectory(pData)

* Code adding above info to a listbox - ListDirectory
Lparameters tcFileData
local lnIndex, llIsDirectory, lnFileSize, lcFileName
With this.lstFTP
	lnIndex = .ListCount + 1
	llIsDirectory = bittest(asc(tcFileData),4)
	lnFileSize = thisform.Str2Num(substr(tcFileData,29,8))
	tcFileData = substr(tcFileData,45)
	lcFileName = substr(tcFileData,1,at(chr(0),tcFileData)-1)
	.AddlistItem(lcFileName,lnIndex,1)
	.AddlistItem(trans(lnFileSize),lnIndex,2)
	.AddlistItem(iif(llIsDirectory,'Directory','File'),lnIndex,3)
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform