Bug #18250 Updated: php can't receive curl made multipart-form posts()
| From: | alberty at neptunelabs dot de | Date: | Wed, 10 Jul 2002 08:07:00 +0000 |
| Subject: | Bug #18250 Updated: php can't receive curl made multipart-form posts() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13694@lists.php.net to get a copy of this message | ||
ID: 18250
Updated by: alberty@neptunelabs.de
Reported By: alberty@neptunelabs.de
-Status: Bogus
+Status: Open
Bug Type: cURL related
Operating System: i686-pc-linux-gnu
PHP Version: 4CVS-2002-07-09
New Comment:
Have you really test the script or have you only _read_ the script?
I don't think the problem is libcurl because you can verify the problem
with the old 7.9.5 and the current curl cvs tree.
It is only depended with the PHP version!
Previous Comments:
------------------------------------------------------------------------
[2002-07-09 19:45:07] sniper@php.net
You're not really uploading any files here, only sending the data in
the file. Not a bug in PHP.
Maybe there's some bug in Curl itself?
------------------------------------------------------------------------
[2002-07-09 13:01:29] alberty@neptunelabs.de
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 this bug report at http://bugs.php.net/?id=18250&edit=1