libcurl, PHP, HTML forms, and an array of values

"Thomas Tremain" <[email protected]>
Newsgroups gmane.comp.web.curl.php
Message-ID <000501cb4b52$692476f0$3b6d64d0$@com>
I am trying to use cURL to post to a form, that uses an array of values,
like:

<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="file" name="photo[]">
<input type="file" name="photo[]">
<input type="file" name="photo[]">

or:
<SELECT name="img_gallery[]" SIZE=3 MULTIPLE>
<OPTION VALUE="16869.jpg"> - 16869.jpg
<OPTION VALUE="16864.jpg"> - 16864.jpg
</SELECT>

All other POSTvars seem to work fine.

 

 

 

 

 $posts=array('photo'=>"@bp10-02-01.jpeg", 
    'img_gallery'=>'168649mojave1.jpg'); 


$ch = curl_init(); 
curl_setopt($ch, CURLOPT_URL,$URL); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); 
curl_setopt($ch, CURLOPT_USERAGENT, $agent); 
curl_setopt($ch, CURLOPT_POST, 1); 
curl_setopt($ch, CURLOPT_POSTFIELDS,$posts); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_REFERER, $reffer); 
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file_path); 
curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file_path); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE); 
$result = curl_exec ($ch); 
curl_close ($ch); 
echo '----------------------<br>'; 
echo("Results: <br>".$result); 

 

The files never get uploaded, because they are supposed to be in an array.
Yet putting them in an array doesn't seem to help.

_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.