alf.nu / @steike

Send File

A little tool to send a file directly from the browser

On the receiving end, open a shell and do

nc -l 2000 | perl

To send the file, type the IP address of the recipient here:

In the other direction, python -m SimpleHTTPServer is good enough for everything except video (missing Range support). For range support, use the Haskell version: stack install wai-app-static; warp

How it works

The browser sends a POST that looks like this:

POST /q( HTTP/1.1
Host: blah
User-Agent: blah
Content-Type: multipart/form-data; boundary=bleh

--bleh
Content-Disposition: form-data; name="foo"
) if 0;

# some ugly perl code to unpack the 'archive' here

__DATA__
--bleh
Content-Disposition: form-data; name="f"; filename="file.txt"

<file content here>
--bleh--

... which ends up being a valid but somewhat silly perl script that starts with the bareword POST divided by a string literal.

Complaints to @steike or @steike.