Please when posting code place it between [php] and [/php] tags so that its easier to read.
I am not a curl expert but I know that this usually means the HTTP VERB either POST or GET wasnt accepted by the web host.
I found an example here and tried to put it into the context of your needs:
<?php
if (isset($_POST['Submit'])) {
if (!empty($_FILES['upload']['name'])) {
$request_url = http://mysite.com/uploads/'.$_FILES['upload']['name']; // I am unsure of how you are uploading a file here, normally it is to a script which handles the file upload.
$localfile = $_FILES['upload']['tmp_name'];
$fp = fopen($localfile, 'r');
$post_params['file'] = '@'.$localfile; // where 'file' is the name of the form variable expecting a file
$post_params['submit'] = urlencode('submit');
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
$error_no = curl_errno($ch);
curl_close($ch);
if ($error_no == 0) {
$error = 'File uploaded succesfully.';
} else {
$error = 'File upload error.';
}
} else {
$error = 'Please select a file.';
}
}
?>
However, one item you should also look at is the fact that you are posting to a URL that includes the filename of the file you uploaded.
Normally on the server side that file that you are posting to is a script that handles the upload.
I hope I have helped point you into the right direction.