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
\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

http://www.phpclasses.org/package/3753-PHP-Upload-files-via-HTTP-POST-using-Curl.html