Try the following:
   
  open(DLFILE, "<$files_location\test.pdf") or die "Could not open file for 
reading: $!\n";
binmode(DLFILE);
binmode(STDOUT);
while (
    read (DLFILE, $buffer, 65536) # read in (up to) 64k chunks
    print $buffer # output the contents of the buffer
  );
close (DLFILE);

[EMAIL PROTECTED] wrote:
  Send Perl-Win32-Web mailing list submissions to
perl-win32-web@listserv.ActiveState.com

To subscribe or unsubscribe via the World Wide Web, visit
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Perl-Win32-Web digest..."


Today's Topics:

1. Perl/Binmode issue (Zahir Lalani)


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

Message: 1
Date: Sat, 6 Jan 2007 15:42:17 +0000
From: "Zahir Lalani" 
Subject: Perl/Binmode issue
To: perl-win32-web@listserv.ActiveState.com
Message-ID:
<[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Hello

not sure what is going on here. I have a standard xampp install on win XP,
with the updated install of perl - which is activeperl 5.8.8. I have some
test code to send a pdf from the cgi to the browser as follows:


#!C:/Program Files/xampp/perl/bin/perl

print "Content-Type:application/pdf\n";
print "Content-Disposition:attachment;filename=test3.pdf\n\n";

my $files_location;
my $ID;
my @fileholder;

$files_location = "C:\Data\Perl";

open(DLFILE, "<$files_location\test.pdf");
binmode(DLFILE);
binmode(STDOUT);
@fileholder = ;
close (DLFILE);

print @fileholder;

====

When I run this, I get the save as dialog. Whether I save or open directly,
the resulting data is deemed as corrupt by acrobat. If I access the file
directly via apache rather than the cgi, it works fine. To make sure the
code was OK, I ran the same code (apart from the paths and the binmode) on a
unix install - and it worked fine. I also tried an equivalent version of PHP
via the xampp install - worked fine. So this seems to be a perl issue on
win32.

Has anyone got a clue as to what the problem could be?



Thx

-- 
Zahir Lalani
SystemZ
[EMAIL PROTECTED]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
http://aspn.activestate.com/ASPN/Mail/Browse/Threaded/perl-win32-web/attachments/20070106/3f28da2f/attachment-0001.html
 

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

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs


End of Perl-Win32-Web Digest, Vol 32, Issue 1
*********************************************

_______________________________________________
Perl-Win32-Web mailing list
Perl-Win32-Web@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to