Re: (possible) zip and file download problem

2001-04-23 Thread Niklas Nordebo

On Mon, Apr 23, 2001 at 12:06:06PM +0100, Jon Galliers wrote:
 The main problem is that the zipped file downloads as 
 and not

I think you might like to have a look at the Content-Disposition MIME

Something like this:

print Content-type:application/x-zip-compressed\n .
  Content-Disposition: attachment; filename=$file\n\n;

Niklas Nordebo -- [EMAIL PROTECTED] -- +447966251290
 The day is seven hours and fifteen minutes old, and already it's
crippled with the weight of my evasions, deceit, and downright lies

Re: (possible) zip and file download problem

2001-04-23 Thread Merijn Broeren

Quoting Jon Galliers ([EMAIL PROTECTED]):
 ($file - name from database query)
 my $zip = Archive::Zip-new() or die couldn't create zip $!;
 $zip-addFile(/web/$file) or die couldn't add file $!;
 $zip-writeToFileNamed('/web/');# possible 
 lock error;
 open (DOCZIP, /web/ 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/ or die couldn't delete 
 file $!;
Another trick that we used was to overload the pathinfo. Just create a
URL that looks like 

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 in it's path info. 

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.