Quoting Jon Galliers ([EMAIL PROTECTED]):
> 
> 
> ($file - name from database query)
> 
> my $zip = Archive::Zip->new() or die "couldn't create zip $!";
> $zip->addFile("/web/www.website.com/docs/$file") or die "couldn't add file $!";
> $zip->writeToFileNamed('/web/www.website.com/docs/download.zip');# possible 
> lock error";
> open (DOCZIP, "/web/www.website.com/docs/download.zip") or die "couldn't 
> open file $!";
> 
> flock (DOCZIP, 2);
> 
> print "Content-type:application/x-zip-compressed\n\n";
> 
> my $fileData;
> while (read(DOCZIP, $fileData, 1024)) {
>          print $fileData;
> }
> 
> unlink ("/web/www.website.com/docs/download.zip") or die "couldn't delete 
> file $!";
> 
> close(DOCZIP);
> 
Another trick that we used was to overload the pathinfo. Just create a
URL that looks like www.website.com/cgi-bin/NameOfCGI/fileno.zip. 

Netscape and Explorer will take the last bit to prompt you with in the
Save As dialog, while the webserver will just invoke NameOfCGI, which in
turn will be able to find fileno.zip in it's path info. 

Cheers,
-- 
Merijn Broeren     | Sometime in the middle ages, God got fed up with us 
Software Geek      | and put earth at sol.milky-way.univ in his kill-file.
                   | Pray all you want, it just gets junked.

Reply via email to