POSTing a file's contents with CURL

What you want is "[email protected]" (no =).

From the curl manpage:

name@filename This will make curl load data from the given file (including any newlines), URL-encode that data and pass it on in the POST. The name part gets an equal sign appended, resulting in name=urlencoded-file-content. Note that the name is expected to be URL-encoded already.


I'll leave qmega's answer as the accepted one, but I'll put an answer I left in a comment here too for easier reading. One other way to do this is simply by specifyping "file=`cat x.py`". For the full command, it would be:

curl --data-urlencode "file=`cat x.py`" http://matt.might.net/apps/pylex/pylex.php