Sending FILE post data through PHP code

Is there a way to send FILE post data through PHP code.

I found a code which send common POST data:

fputs($fp, "POST $path HTTP/1.1\r
fputs($fp, "Host: $host\r
fputs($fp, "Referer: $referer\r
fputs($fp, "Content-type: application/x-www-form-urlencoded\r
fputs($fp, "Content-length: “. strlen($data) .”\r
fputs($fp, "Connection: close\r
fputs($fp, $data);

How do I send $_FILES data through POST. Is that posible?

You Can do it easily with CURL library

check this class out