Download file size
Download file size
- Subject: Download file size
- From: Marc Laffitte <email@hidden>
- Date: Mon, 8 Oct 2001 11:08:33 +0200
Hi,
I would like to do a really simple thing: I wish to know the size of a
file before downloading it.
I tried the following:
...: (NSString*)inUrl
{
NSURL *tUrl = [NSURL URLWithString:inUrl];
id tFileSize;
tFileSize = [tUrl propertyForKey:(NSString*)kCFURLFileLength];
...
}
But I allways get nil.
The documentation about propertyForKey for an NSURL says "description
forthcoming". Well, how should I know wich keys I can use?
I tried with kCFURLFileLength because I first tried using
CFURLCreatePropertyFromResource with that propety. However, I either got
a kCFURLPropertyKeyUnavailableError error for http:// files,
kCFURLUnknownSchemeError for ftp:// files or no error but a zero length
result for the file:// scheme.
I suppose I am doing something wrong. Can someone help?
Thanks,
Marc