PHP Curl Batch upload, and with post other forms, multi-file upload why can not be transmitted to other post

Source: Internet
Author: User
Keywords Php
PHP Curl Batch upload, and with post other forms, a single upload can be with the post, can be batch of words, there is no way?


  
    'Foo', 'file'=>$file); //多文件上传为什么不能再传其它post//变成//$data = $file;curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');curl_setopt($ch, CURLOPT_POST, 1);if (class_exists('\CURLFile')) {     curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);} else {    if (defined('CURLOPT_SAFE_UPLOAD')) {        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);// 5.6 给改成 true了, 弄回去     

How can the final run result be like a form, and what $_FILES $_POST ?

Single file is OK, but a lot of files are not, how to do?

Reply content:

PHP Curl Batch upload, and with post other forms, a single upload can be with the post, can be batch of words, there is no way?


  
    'Foo', 'file'=>$file); //多文件上传为什么不能再传其它post//变成//$data = $file;curl_setopt($ch, CURLOPT_URL, 'http://localhost/upload.php');curl_setopt($ch, CURLOPT_POST, 1);if (class_exists('\CURLFile')) {     curl_setopt($ch, CURLOPT_SAFE_UPLOAD, true);} else {    if (defined('CURLOPT_SAFE_UPLOAD')) {        curl_setopt($ch, CURLOPT_SAFE_UPLOAD, false);// 5.6 给改成 true了, 弄回去     

How can the final run result be like a form, and what $_FILES $_POST ?

Single file is OK, but a lot of files are not, how to do?

I remember it was necessary to give a filename. The array could not be passed past. Only key can be specified.

$postfileds = [    'file1' => CURLFile(xxxxx    'file2' => CURLFile(xxxxxxx    # 一定要用数组那也一定要这么写    'file[]' => CURLFile(xxxxxx    'file[]' => CURLFile(xxxxx];

Set the File_path as an array loop execution

  • 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.