Re: File size of a downloadable file
Re: File size of a downloadable file
- Subject: Re: File size of a downloadable file
- From: Jeremy Dronfield <email@hidden>
- Date: Sun, 18 Apr 2004 10:49:20 +0100
Just as an addition to this, there's a neat demonstration of using
these delegate methods to increment a progress indicator in
/Developer/Examples/WebKit/Downloader.
Jeremy
On 17 Apr 2004, at 9:36 pm, Scott Anguish wrote:
On Apr 17, 2004, at 2:02 PM, Pat Homelvig wrote:
*This message was transferred with a trial version of CommuniGate(tm)
Pro*
Does anyone know how you might be able to programmatically get the
size of a file you are going to download before you start
downloading?
I would like to show the progress of downloading a file in my app
(xxxx bytes of yyyy bytes total).
The NSURLResponse returned by the connection:didReceiveResponse: (or
download:) delegate method includes a method -expectedContentLength.
it'll return the length that you can expect (if it's possible to
determine) or -1 if you can't.
then in your
- (void)connection:(NSURLConnection *)connection
didReceiveData:(NSData *)data
{
// append the new data to the receivedData
[receivedData appendData:data];
}
you can increment the current length received data by checking the
length of the newly received data chunk and incrementing a counter..
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.