#!/usr/bin/env perl

use CGI;
my $cgi = new CGI;

#if ( length($cgi->param('file')) > 30 ) {
	my $ct = "file -i ".$cgi->param('file');
	$ct = `$ct`;
	$ct = (split /[:]/, $ct)[-1];
	chomp $ct;
	print "Content-type: $ct\n\n";
#	print STDERR "Content-type: $ct\n\n";
#}
#else {
#	print "Content-type: text/plain\n\n";
#}


use strict;

open(my $f, '<' . $cgi->param('file'));
my @lines = <$f>;
print @lines;
#while (<$f>) {
#	print;
#}
close $f;


