I'm trying to upload a local file to a website of mine, I have a php script waiting to recieve the file,
I've been only able to do this using libcurl, particularly this function:
function upload($file,$name){
global $portal;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$h=fopen('curl.txt','a');
curl_setopt($ch,CURLOPT_STDERR,$h);
curl_setopt($ch,CURLOPT_VERBOSE,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible
");
curl_setopt($ch, CURLOPT_URL,"recieve.php");
curl_setopt($ch, CURLOPT_POST, true);
// same as <input type="file" name="file_box">
$post = array(
"uploadedfile"=> "@$file",
"fname" => $name
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
}
now I'm trying to do it without libcurl
any ideas?
I've been only able to do this using libcurl, particularly this function:
function upload($file,$name){
global $portal;
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$h=fopen('curl.txt','a');
curl_setopt($ch,CURLOPT_STDERR,$h);
curl_setopt($ch,CURLOPT_VERBOSE,true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible
curl_setopt($ch, CURLOPT_URL,"recieve.php");
curl_setopt($ch, CURLOPT_POST, true);
// same as <input type="file" name="file_box">
$post = array(
"uploadedfile"=> "@$file",
"fname" => $name
);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
$response = curl_exec($ch);
}
now I'm trying to do it without libcurl
any ideas?