Newsgroups : Borland : borland.public.delphi.internet.winsock : 2007 Feb : Re: TidFTP no file size returned
| Subject: | Re: TidFTP no file size returned |
| Posted by: | "API" (ari.pikivir..@kolumbus.fi) |
| Date: | Mon, 26 Feb 2007 23:39:54 |
True is that filesize shouldn't be used for differentiating between
directory and file, but fore example firefox as ftp client does that. But
also, filesize is not enough to make the difference - if filesize is <0
still the client must check if it's file by trying to retrieve it.
So, if you still prefer doing that, i suggest adding retrieve the file also.
You could always break the connection before the file is downloaded :). Not
recommended, but if the server doesn't support many of the things.
/API
"Michael Fritz" <spam_athome@yahoo.de> wrote in message
news:18g8aixbnvf1m$.igilojgtr6c7$.dlg@40tude.net...
> Hi,
>
> Using Indy 10.1.15 in Turbo Delphi I'm trying to retrieve the file size of
> a file located on a FritzBox (DSL router, linux OS).
>
> While the IE6 shows the file size correctly, using the FTPClient demo of
> Indy 10 is not able to get it in this line:
>
> i := lbDirectory.ItemIndex;
> if i <> -1 then
> begin
> s := lbDirectory.Items[i];
> i := FTP.Size(s);
> if i = -1 then << always returns -1
> begin
> // Directory
> ChangeFTPDir(s);
> end
> else
>
> As Size(s) always returns -1 for a file(!) it tries to change the
> directory
> but throws an exceptions since this is not really a dir.
>
> So, what's the deal here? Do I have to add a FTP parser as I've read in
> some threads here?
> --
> cu,
> Michael
none