in reply to Re: Downloading images to client PCs
in thread Downloading images to client PCs
The code I used looks like this:
I'm serving this up with Apache 2.0.40 on WinXP.my $file = 'd:\imaging\building.jpg'; my $zip_name = get_session() . ".zip"; my $zip = Archive::Zip->new(); $zip->addFile($file) or die "Can't add to zip!\n"; $zip->writeToFileNamed($zip_name); my $filesize = -s $zip_name; my $buffer; # Read the zip file open READ, "< $zip_name" or die "Cannot open $zip_name for reading: $! +"; binmode READ; { local $/; $buffer = <READ>; } close(READ); binmode STDOUT; print "Content-Disposition: inline; filename=document.zip\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/zip\n\n"; print $buffer;
MrCromeDome
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Downloading images to client PCs
by dws (Chancellor) on Sep 12, 2002 at 19:56 UTC |