>> -----Original Message-----
>> From: Octavian Rasnita [mailto:[EMAIL PROTECTED]]
>> 
>> I want to check if a certain file is downloading  in this 
>> moment by a page
>> visitor.
>> Is it possible with Perl?

Another option which is widely used is to have a cgi-script
do the file "download", by printing the binary out. That way
you can closely monitor the file downloads.  I just printed to
a log, but you could do anything you want. You could have a 
cgi program, which checks this log, and tail it. 
Then "if ($tail =~ /downloading/){print "downloading now\n"}

Of course you will need to work out what happens if 2 or more
users are downloading at the same time.
  
###################################################
#!/usr/bin/perl
$file = 'test.tgz';
open (LOG,">>test-tgz.log") or die "Couldn't open log: $!";
print LOG "downloading now,      start: ",scalar localtime(),"\t",
$ENV{REMOTE_ADDR},"\n";

print<<EOH; 
Content-type: application/octet-stream 
Content-Disposition: attachment\; filename=$file 

EOH
binmode STDOUT;
open (FH, "$file") or die "Can't open $file: $!";
binmode FH;
while(<FH>){print}
close (FH);

print LOG "downloading finished, stop: ",scalar localtime(),"\t",
$ENV{REMOTE_ADDR},"\n";
close LOG;

exit 0;
##################################################



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to