How can I upload a file, either by using cURL or anything else, in PHP?
In other words, the user sees a file upload button on a form, the form gets posted to my PHO script, then my PHP script needs to re-post it to another script (eg on another server).
I have this code to receive the file and upload it:
echo"".$_FILES['userfile']."";
$uploaddir = './';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
if ( isset($_FILES["userfile"]) ) {
echo '<p><font color="#00FF00" size="7">Uploaded</font></p>';
if (move_uploaded_file
($_FILES["userfile"]["tmp_name"], $uploadfile))
echo $uploadfile;
else echo '<p><font color="#FF0000" size="7">Failed</font></p>';
}
How can I send the file to the receiver server?