Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get size of an FTP file?
Message
From
23/03/2004 11:50:34
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00888903
Message ID:
00888913
Views:
37
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform