Look on the internet for an explanation of the POST request of the HTTP specification. More specifically, the part dealing with file uploads. You'll see that you have to create a proper request header, attach the file (after encoding) and then open a socket to the remote server, send the request/file, and check the output. It sounds daunting, but because of HTTP, it's really quite simple and straight-forward.
If you proceed, some quick tips: check your mime-types and HTTP version 🙂 (I'd suggest using HTTP 1.0, and use the host header to maintain compatability with servers using name-based virtual hosts)