[Php]curl Upload Multiple files

Source: Internet
Author: User

Code, curl, upload multiple-file lines.

5.5 Previous versions of the notation

$file Array (            ' pic[0] ' = ' @e:\\wwwroot\\10003\\temp_56.ini;type=text/html;filename=temp_56.ini ',            ' pic[1 ] ' = ' @e:\\wwwroot\\10003\\temp_29.html;type=text/html;filename=temp_29.html '        );

5.5 The wording of the above version

PHP 5.5 version or above        $filearray(            ' pic[0] ' = =new curlfile (' E:\\wwwroot\\10003\\temp_56.ini ', ' text/html ', ' Temp_56.ini '),            ' pic[1 ', ' = =new curlfile (' e:\\ Wwwroot\\10003\\temp_29.html ', ' text/html ', ' temp_29.html ')        ;

Merge other post parameters, post out

$data=Array_merge($file,$data);$ch=curl_init (); curl_setopt ($ch, Curlopt_url,$url); curl_setopt ($ch, Curlopt_post,true); curl_setopt ($ch, Curlopt_postfields,$data); curl_setopt ($ch, Curlopt_header,false); curl_setopt ($ch, Curlopt_returntransfer,true);//Curl_getinfo ($ch);$return _data= Curl_exec ($ch); Curl_close ($ch);Echo $return _data;

[Php]curl Upload Multiple files

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.