Thanks 4 replying Connie, but it didn't work..... i already did binmode STDOUT,
and tried this print "Content-type: image/jpeg\r\n\r\n"; as advise. i just hope some1 here can remind me what else i forgot to do. thanks... Connie Chan <[EMAIL PROTECTED]> wrote in message 001601c2439e$68cc2be0$[EMAIL PROTECTED]">news:001601c2439e$68cc2be0$[EMAIL PROTECTED]... > > 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; > > > > Of cause, you didn't open the file and read the file. > > You are trying to print "/home/myaccount/uploads/laptop.jpg" > to the screen, but with a image header. That's fatal error. > > > > > 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; > > You also have to binmode the STDOUT > > > print "Content-type: image/jpeg\n\n"; > > That should be .../jpeg\r\n\r\n"; > > Rgds, > Connie > -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]