Added variable

This commit is contained in:
qorg11 2020-04-26 00:58:10 +02:00
parent e4efd404ed
commit ee791ee09b
No known key found for this signature in database
GPG key ID: 343FC20A4ACA62B9

View file

@ -15,23 +15,30 @@
# along with lainsafe. If not, see <https://www.gnu.org/licenses/>. # along with lainsafe. If not, see <https://www.gnu.org/licenses/>.
use CGI; use CGI;
use CGI::Carp qw(fatalsToBrowser);
my $q = CGI->new; my $q = CGI->new;
print $q->header();
my $filename = $q->param('file');
# TODO: fix 502 # TODO: fix 502
my $upload_dir = "files/"; my $upload_dir = "files/";
my $filename = $q->param("file"); print $q->header();
$size = $ENV{CONTENT_LENGTH};
$MAX_SIZE = 1024*1024*10; # Change for your size
$MAX_SIZE_MB = $MAX_SIZE / 1024 / 1024; # Don't change this
if($filename eq "") { if($filename eq "") {
print("What are you looking for?"); print("What are you looking for?");
exit; exit;
} }
if($size > $MAX_SIZE)
{
print("Max size for a file is $MAX_SIZE_MB MBs");
exit;
}
my $extension = $filename; my $extension = $filename;
$extension =~ s/.*\.//; $extension =~ s/.*\.//;
my @chars = ("A".."Z", "a".."z"); my @chars = ("A".."Z", "a".."z");
my $string; my $string;
$string .= $chars[rand @chars] for 1..8; $string .= $chars[rand @chars] for 1..8;