I found a solution from the internet, which uses curl with php, but it only works if the file to be uploaded is in the same location as the server.
In the code below, the image I want to upload is from the client PC, c:\a.jpg, but it does not work. Anybody has any suggestion? Thanks!
<?php
// URL on which we have to post data
$url = "http://home.com/processImage.php";
// File you want to upload/post
$post_data['file'] = "@c:/a.jpg";
// Initialize cURL
$ch = curl_init();
// Set URL on which you want to post the Form and/or data
curl_setopt($ch, CURLOPT_URL, $url);
// Data+Files to be posted
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
// Pass TRUE or 1 if you want to wait for and catch the response against the request made
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// For Debug mode; shows up any error encountered during the operation
curl_setopt($ch, CURLOPT_VERBOSE, 1);
// Execute the request
$response = curl_exec($ch);
// Just for debug: to see response
echo $response;
?>