upload.pl
branchonce
changeset 34 4f5b1795bc92
parent 32 aa35cf36f313
child 35 1800d3b7d5a6
equal deleted inserted replaced
33:54f575c3d0c5 34:4f5b1795bc92
    63             exit 0;
    63             exit 0;
    64         }
    64         }
    65         $absolute =~ m|^\Q$base/$DIR\E| or die "invalid path: [$absolute]";
    65         $absolute =~ m|^\Q$base/$DIR\E| or die "invalid path: [$absolute]";
    66 
    66 
    67         open F, '<', $absolute or die "Can't open '<', '$absolute': $!";
    67         open F, '<', $absolute or die "Can't open '<', '$absolute': $!";
    68         print header(-type => mimetype($absolute));
    68         print header(-type => mimetype($absolute), -charset => 'UTF-8');
    69         if (request_method() ~~ [qw(GET POST)]) {
    69         if (request_method() ~~ [qw(GET POST)]) {
    70             my ($buf, $res);
    70             my ($buf, $res);
    71             print $buf while $res = read F, $buf, 32 * 2**10;
    71             print $buf while $res = read F, $buf, 32 * 2**10;
    72             defined $res or die "Can't read: $!";
    72             defined $res or die "Can't read: $!";
    73 
    73