Browse Source

Modified the way lainsafe renames file

Before this commit lainsafe would generate a random string
which can create coallition between two files and shit would
happen, after this commit, lainsafe generates its filenames by
getting the UNIX time in miliseconds (like 4chan)
pull/1/head
qorg11 1 year ago
parent
commit
8a557ca108
Signed by: qorg11 GPG Key ID: 343FC20A4ACA62B9
  1. 7
      http/upload.cgi

7
http/upload.cgi

@ -16,6 +16,7 @@
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use Time::HiRes qw(gettimeofday);
my $q = CGI->new;
my $filename = $q->param('file');
@ -46,10 +47,10 @@ if($size > $MAX_SIZE)
my $extension = $filename;
$extension =~ s/.*\.//; # tar.gz sucks with this
# Generate random string
my @chars = ("A".."Z", "a".."z");
# Get unix time in miliseconds
my $string;
$string .= $chars[rand @chars] for 1..8;
$string = gettimeofday; # perl, what?
$string =~ s/\.//g;
my $upload_filehandle = $q->upload("file");

Loading…
Cancel
Save