Perl: How To Display Images (binary Data) From A Perl CGIYou can output almost any sort of data using the" Content-type: tag." eg :- #!/usr/bin/perl -w my $file = "Schogini7kAdobe1.gif"; my $length = (stat($file)) [10]; open (FH,"<$file") || die "Could not open $file: $!"; @data = ; print "Content-type: image/gif\n"; print "Content-length: $length \n\n"; print @data; close(FH); Note : The "stat" function will return the file info like File mode, device no, total size etc; "$length" variable has the file size. "<" sing means Open the file for Reading only. *Note: File must have an ".cgi" extension. |