Archived Forum Post

Index of archived forum posts

Question:

GetSize() or getSizeByName() in FTP2

Jan 10 '14 at 09:28

Hi to all, I'm using FTP2 Ocx 32bit Class

I'm trying to get a remote file size to use in my percent bar. loFtp.Connect() is OK loFtp.ChangeRemoteDir("mydir") is OK loftp.GetCurrentRemoteDir() returns "mydir" that is OK loftp.GetFileName(1) returns "myfile" that is OK

loftp.GetSize(1) returns -1 (that is KO !!! Why!) or loftp.GetSizeByName("myfile") returns -1 (that is KO !!! Why!)

where am I wrong? Thanks Daniele


Answer

First, make sure that you are using the latest version of the library (9.4.1).

Next, after calling .GetSize(1), record the return value of the LastErrorText property, and then post it here in <pre></pre> tags.

We can review the log and see if there are any clues as to why you are getting the result that you are.


Answer

Also - are the files large (>2 GB)? If so, maybe the size won't fit in a 32-bit integer. What results do you get if you call .GetSizeStr(1) instead?


Answer

Hi Jpbro, It's very strange. This morning I tried again to run the commands to check the version and LastErrorText property and everything works. I do not know why it doesn't work last night. However, the version is 9.4.1.42. Thanks for everything. Daniele


Answer

Of course, if it were to happen again I will surely. Thanks Daniele