upload.pl
changeset 1 2f299c7ef0c9
parent 0 6d8dea55365a
child 3 8b499dbf38ca
--- a/upload.pl	Thu Sep 17 23:33:03 2009 +0200
+++ b/upload.pl	Thu Sep 17 23:57:52 2009 +0200
@@ -17,7 +17,7 @@
 use Digest::SHA1 qw(sha1_hex);
 
 my $DIR = "upload.d";
-my $LINK_DIR = url(-base => 1) . dirname($ENV{SCRIPT_NAME}) . "/$DIR";
+my $LINK_DIR = dirname($ENV{SCRIPT_NAME}) . "$DIR";
 
 -d $DIR
   or mkdir $DIR => 0750
@@ -58,13 +58,21 @@
     }
     print hr;
 
+    print p <<__;
+	Der gültige Download-Link ist die Link-Adresse, die sich hinter
+	dem Datei-Namen verbirgt. (Firefox: Rechte Maustaste, Link-Location).
+__
+
     print start_table, Tr(th { align => "left" }, [qw/name size date expires/]);
 
     foreach (map { /(.*)/ } sort { -M $a <=> -M $b } glob "$DIR/*-*/*") {
         my ($file, $dir) = fileparse($_);
         $dir = basename $dir;
-        $dir =~ /(?<hash>\S+)-(?<expires>\d+)$/ or next;
-        if ($+{expires} <= time) {
+        # $dir =~ /(?<hash>\S+)-(?<expires>\d+)$/ or next;
+        $dir =~ /(\S+)-(\d+)$/ or next;
+	my $hash = $1;
+	my $expires = $2;
+        if (${expires} <= time) {
             /(.*)/;
             unlink $_  or die "Can't unlik $_: $!\n";
             rmdir $dir or die "Can't rmdir $dir: $!\n";
@@ -75,7 +83,7 @@
             td(a { href => "$LINK_DIR/$dir/$file" }, $file),
             td({ align => "right" }, (stat $_)[7]),
             td(scalar localtime +(stat $_)[9]),
-            td(scalar localtime $+{expires}),
+            td(scalar localtime ${expires}),
             td(a({ href => "?delete=$dir" }, "remove"))
         );
     }