>> Is there any way to get the size of a file without downloading it?
>> I want to write a program using LWP to download a file only
>> if it is bigger than 3K but smaller than 500K.
>> So I need to know the file size in the first place.
>
>Try making a HEAD request - that should return
>file size and last modification date. This
>obviously will not work for CGI URLs.

Something like:

   my $ua = LWP::UserAgent->new();
   my $result = $ua->head($url);
   my $remote_headers = $result->headers;
   $total_size = $remote_headers->content_length;




-- Morbus Iff ( i put the demon back in codemonkey ) Culture: http://www.disobey.com/ and http://www.gamegrene.com/ My book, Spidering Hacks: http://amazon.com/exec/obidos/ASIN/0596005776/ icq: 2927491 / aim: akaMorbus / yahoo: morbus_iff / jabber.org: morbus


-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to