You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Michael Clarke <Mi...@ird.govt.nz> on 2002/03/03 20:13:02 UTC

attn: Gerald Richter

Thanks for answering my zip problem question relating to embperl - one question thou - what was the difference between your code and mine?

Yours:

####################################################

You must set $escmode = 0 to be able to send binary data. When $escmode = 0,
Embperl also handles null bytes correctly. Since you have done this already,
null bytes shouldn't be the issue, but your example code will insert some \n
before your binary data, because of the line breaks between the blocks,
better write it like the following:

[- use MYLIB; use  CGI qw/:standard :html3 escape/;
-][$ var $status  $msg $file_hdl $filestate $version $offset $buffer
$save_name $save_rp $save_type $name $filename
$][-
 $escmode =0;
 ($save_name, $save_rp,$save_type) = split /:/, $fdat{'filelist'};





####################################################




Mine



####################################################






[- use MYLIB; use  CGI qw/:standard :html3 escape/;-]
[$ var $status  $msg $file_hdl $filestate $version $offset $buffer $save_name $save_rp $save_type $name $filename
$]
[-
 $escmode =0;
 ($save_name, $save_rp,$save_type) = split /:/, $fdat{'filelist'};

($status,$msg,$file_hdl,$filestate,$version) = MYLIB::view_file('1.1',$save_name,$save_rp,$save_type);

$filename="test.zip";

$http_headers_out{'Content-Disposition'} = ": attachment; filename=$filename";

$http_headers_out{'Content-type'}= 'x-application/octet-stream';
$http_headers_out{'Content-encoding'}='x-gzip';

    while (read($file_hdl, $buffer, 1024) ) {

       print OUT "$buffer";
    }

   close($file_hdl);

-]

####################################################

Thanks.

Michael Clarke
IRD Open Systems Team

Level 4, Telecom House
13-27 Manners Street
Wellington

Phone: +64 (04) 8031423
Mobile: +64 021 455 218
email: michael.clarke@ird.govt.nz
email: mac@ird.govt.nz

Michael Clarke
IRD Open Systems Team

Level 4, Telecom House
13-27 Manners Street
Wellington

Phone: +64 (04) 8031423
Mobile: +64 021 455 218
email: michael.clarke@ird.govt.nz
email: mac@ird.govt.nz


---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: zip files and downloading

Posted by Gerald Richter <ri...@ecos.de>.
>Thanks for answering my zip problem question relating to embperl - one
question thou - what was the difference >between your code and mine?

Your contains newlines outside the [-/+/$ $/+/-] blocks, which will be pass
to the browser before the binary output, mine avoids these newlines by
putting them inside the block.

Gerald

P.S. Please keep the subject, it's easier to follow and makes a correct
thread in the mailing list archives

-----------------------

Yours:

[- use MYLIB; use  CGI qw/:standard :html3 escape/;
-][$ var $status  $msg $file_hdl $filestate $version $offset $buffer
$save_name $save_rp $save_type $name $filename
$][-
 $escmode =0;
 ($save_name, $save_rp,$save_type) = split /:/, $fdat{'filelist'};

Mine


[- use MYLIB; use  CGI qw/:standard :html3 escape/;-]
[$ var $status  $msg $file_hdl $filestate $version $offset $buffer
$save_name $save_rp $save_type $name $filename
$]
[-
 $escmode =0;
 ($save_name, $save_rp,$save_type) = split /:/, $fdat{'filelist'};


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------






---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org