where do you get the impression that \n\n is for text file and \r\n\r\n
is for binary data??? did you get that somewhere? \r\n\r\n is OS
specific but \n\n is portable. does Win32 and UNIX-ish use the same
crlf? your best beat is to use \n\n where Perl will
translate(transparently in the background) that into whatever correct
crlf your OS uses. if you use \r\n\r\n, you are asking your code not to
be portable.

i also don't understand why you said whenout binmode STDOUT and IMAGE,
the read / print process will terminated after 1024K. does this happened
to your application or do you refer it in general.

you could be right that binmode STDOUT should help too...
 
david

On Wed, 2002-08-21 at 02:56, Connie Chan wrote:
> No... I believe. I've digging on this topic for very very long 
> time on my Win32, Sambar and Apache server.
> 
> I can't print any image out without \r\n\r\n, where \n\n is for 
> text file only. Why? I don't know =) Guess, because \r\n is for
> *binmoded data*.
> 
> And without binmode STDOUT and IMAGE both. the read / print
> process will terminated after 1024k. Why? I don't know either.
> 
> Rgds,
> Connie
> 
> 
> 
> 
> ----- Original Message ----- 
> From: "david" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
> Sent: Wednesday, August 21, 2002 6:48 AM
> Subject: Re: Help!! Retrieving Image File
> 
> 
> > not sure if you already have the answer to this one but you:
> > 
> > binmode IMAGE;
> > print "Content-type: image/jpeg\n\n";
> > while(<IMAGE>){
> >     print;
> > }
> > 
> > should probably be:
> > 
> > print "Content-type: image/jpeg\n\n";
> > binmode IMAGE;
> > while(<IMAGE>){
> >     print;
> > }
> > 
> > you need to print the text header first and than print the 
> > binary image. try it and see if it works or not.
> > 
> > alos, use "\n\n" is better than "\r\n\r\n" because "\n\n" is more
> > portable. you also don't need to binmode STDOUT
> > 
> > david
> > 
> > Perl wrote:
> > 
> > > Hello All,
> > > 
> > > I created a simple http upload file routine that uploads file into my
> > > accounts sub folder uploads, "/home/myaccount/uploads". This is
> > > already running.
> > > 
> > > Now what I wanted to do is retrieve the uploaded file from the
> > > browser, and display the content in the browser if it is an image or
> > > a text/html file, if not then download it. I made a simple code and
> > > its not working for the image file, I hope someone here in the list can
> > > help me.
> > > 
> > > Here are the sample code that I've tried so far and it didn't work.
> > > Kindly please tell me what I missed....
> > > 
> > > 
> > > Code 1: It didnt work...
> > > 
> > > #!/usr/bin/perl
> > > 
> > > use CGI;
> > > $query = new CGI;
> > > my $filepath='/home/myaccount/uploads/laptop.jpg';
> > > 
> > > print $query->header('image/jpeg');
> > > print $filepath;
> > > 
> > > 
> > > Code 2: This code is running ok with text/html files, but not with the
> > > images, I hope someone here can help me.
> > > 
> > > 
> > > #!/usr/bin/perl
> > > 
> > > my $filepath="/home/rce/uploads/drugs.jpg";
> > > 
> > > open(IMAGE, $filepath);
> > > binmode IMAGE;
> > > 
> > > print "Content-type: image/jpeg\n\n";
> > > while(<IMAGE>){
> > >          print;
> > >     }
> > > 
> > > 
> > > 
> > > Thanks in advance
> > > 
> > > Archie
> > 
> > 
> > -- 
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > 
> > 



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to