diff --git a/doc/index.md b/doc/index.md
new file mode 100644
index 0000000..9e2d533
--- /dev/null
+++ b/doc/index.md
@@ -0,0 +1,117 @@
+
+# lainsafecli documentation
+
+## History
+
+[delegao](https://kill-9.xyz/rocks/people/delegao) and I were talking about how much I hate the modern web. He runs which is the same but with JS, so I think it sucked. I started to make lainsafe to replace lolisafe.
+
+## Lainsafe installation
+
+Just put index.html and upload.cgi in a http directory. I use fcgi to run my cgi scripts. So it's what i recommend. To install fcgi on debian, run: ```# apt install fcgiwrap```
+
+here's an example configuration for lainsafe, using nginx.
+
+~~~
+server
+{
+server_name lainsafe.foo.tld;
+
+listen 80;
+listen [::]:80;
+
+root /var/www/lainsafe;
+
+location ~ \.cgi$ {
+gzip off;
+include /etc/nginx/fastcgi_params;
+fastcgi_pass unix:/var/run/fcgiwrap.socket;
+fastcgi_index index.cgi;
+fastcgi_param SCRIPT_FILENAME /var/www/lainsafe/$fastcgi_script_name;
+}
+}
+~~~
+
+## lainsafecli
+
+lainsafecli is a command line interface for lainsafe. It can be used in whatever that runs perl. Instalation is simple: if you're running debian install the libwww-perl package. If you are not running debian, search for that package in your repositories. Or use ```# cpan -i LWP::UserAgent```
+
+### Installation
+
+I haven't made a package for lainsafecli yet. So instalation is basically:
+
+~~~
+# wget https://raw.githubusercontent.com/qorg11/lainsafe/master/lainsafecli \
+-O /bin/lainsafecli && chmod +x /bin/lainsafecli
+~~~
+
+That will install lainsafecli, run ```lainsafecli``` to make sure it is installed.
+
+### Configuration
+
+lainsafecli is a simple software. So it has just 2 configurable
+parameters. lainsafecli do not have a config file. So you have to
+change these parameters in the executable file.
+
+These parameters are located in the line 34 of lainsafecli.
+
+```$DEFAULT_SERVER``` the server that will be used if --server is not
+specified.
+```$DISPLAY_ASCII``` By default is true, change to 0 if you don't want
+the Lain ascii art to appear when you upload a file.
+
+the most "official" lainsafe instance is .
+
+### Usage
+
+Before 1b8373
+
+~~~
+USAGE: lainsafecli [--server] --file=FILE
+~~~
+
+After 1b8373
+
+~~~
+USAGE: lainsafecli [--server] FILE
+~~~
+
+
+for example:
+
+```lainsafe --server=https://lainsafe.foo.bar sicp.pdf```
+
+will upload sicp.pdf to lainsafe.foo.bar
+
+### Sample output
+
+In this output, ```$DEFAULT_SERVER``` is lainsafe.delegao.moe. and ```
+$DISPLAY_ASCII``` equals 1 (true)
+
+~~~
+lainsafecli sicp.pdf
+
+ _..-- ----- --.._
+ ,-'' `-.
+ , \
+ / \
+ / ` . \
+ ' / || ;
+ ; ^/| |/ | |
+ | /v /\`-'v√\'-|\ ,
+ | /v` ,--- ---- .^.| ;
+ : | /´@@`, ,@@`\ | ;
+ ' | '. @@ / \@@ / |\ |;
+ | ^| ----- --- | \/||
+ ` |` | /\ /
+ \ \ |/ |,
+ ' ; \ /| |
+ ` \ -- / | |
+ ` `. .-' | /
+ v,- `;._ _.; | |
+ `'`\ |-_ -^'^'| |
+ ------ |/
+
+https://lainsafe.delegao.moe/files/nzOhDKtB.pdf
+~~~
diff --git a/http/upload.cgi b/http/upload.cgi
index 146d2e7..7ac5d94 100755
--- a/http/upload.cgi
+++ b/http/upload.cgi
@@ -24,6 +24,7 @@ my $filename = $q->param('file');
my $upload_dir = "files/";
print $q->header();
$size = $ENV{CONTENT_LENGTH};
+
# Configuration
$MAX_SIZE = 1024*1024*10; # Change for your size
@@ -34,6 +35,7 @@ if($filename eq "")
print("What are you looking for?");
exit;
}
+
if($size > $MAX_SIZE)
{
print("Max size for a file is $MAX_SIZE_MB MBs");
@@ -41,7 +43,7 @@ if($size > $MAX_SIZE)
}
my $extension = $filename;
-$extension =~ s/.*\.//;
+$extension =~ s/.*\.//; # tar.gz sucks with this
my @chars = ("A".."Z", "a".."z");
my $string;
diff --git a/lainsafecli b/lainsafecli
index 17c1be5..18c0bf5 100755
--- a/lainsafecli
+++ b/lainsafecli
@@ -115,4 +115,3 @@ $req = $ua->post($url_to_upload,
print $ASCII_ART if $DISPLAY_ASCII;
print $DEFAULT_SERVER . "/" . $req->{_content} . "\n";
-