Bug #18250: php can't receive curl made multipart-form posts()
| From: | alberty at neptunelabs dot de | Date: | Tue, 09 Jul 2002 17:01:30 +0000 |
| Subject: | Bug #18250: php can't receive curl made multipart-form posts() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-13629@lists.php.net to get a copy of this message | ||
From: alberty@neptunelabs.de
Operating system: i686-pc-linux-gnu
PHP version: 4CVS-2002-07-09
PHP Bug Type: cURL related
Bug description: php can't receive curl made multipart-form posts()
Hi,
with the current cvs tree, PHP can't receive curl made multipart-form
posts.
With 4.2.0 the script received the files,
but in the current version only a post variable is received.
Here is a small php code.
<---SNIP--->
<?php
function post_packet($exchange_url){
$tmpfname = tempnam ('/tmp', 'UP');
if (!empty($tmpfname)){
$fp = fopen($tmpfname, 'wb');
if ($fp!=false){
fwrite($fp, "123\nfoo\0bar");
fclose($fp);
$packet['test_var']='send';
$packet['test_bin']="@$tmpfname";
$curl = curl_init ();
curl_setopt($curl, CURLOPT_URL, $exchange_url);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $packet);
$result=curl_exec ($curl);
if (curl_errno($curl)>0){
echo "curl error: ($exchange_url) ".curl_error($curl).'<br>';
}
curl_close ($curl);
unlink($tmpfname);
}
}
return $result;
}
$exchange_url=$_SERVER['SCRIPT_URI'];
if (!isset($_POST['test_var'])){
echo "Do POST<br>";
$result=post_packet($exchange_url);
echo $result;
}
else{
if (isset($_FILES['test_bin'])) echo 'file successfully received';
else{
echo 'file missing!!!<br>';
phpinfo();
}
}
?>
<---SNAP--->
I think it is a rfc1867.c or a curl problem, i don't know.
Regards,
Steve
--
Edit bug report at http://bugs.php.net/?id=18250&edit=1
--
Fixed in CVS: http://bugs.php.net/fix.php?id=18250&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=18250&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=18250&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=18250&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=18250&r=support
Expected behavior: http://bugs.php.net/fix.php?id=18250&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=18250&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=18250&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=18250&r=globals