#!/usr/bin/perl use strict; use warnings; my $filename = 'pm.tgz'; my $filesize = -s $filename; # $filepath is the directory # $filename is the name of the file # print full header print "Content-disposition: inline; filename=$filename\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/octet-stream\n\n"; # open in binmode open(READ,,'<',$filename) || die; binmode READ; # stream it out binmode binmode STDOUT; while () { print; } close(READ); # should always return true return(1); #### #!/usr/bin/perl use strict; use warnings; my $filename = 'pm.tgz'; my $filesize = -s $filename; # $filepath is the directory # $filename is the name of the file # print full header print "Content-disposition: inline; filename=$filename\n"; print "Content-Length: $filesize\n"; print "Content-Type: application/octet-stream\n\n"; # open in binmode open my $read,'<',$filename or die "Failed to read $filename - $!"; binmode $read; # stream it out binmode binmode STDOUT; while (<$read>) { print; } # should always return true return(1);