post-php Curl Upload file How to specify its name value like a form

Source: Internet
Author: User
Tags curl upload file
In HTML uploads, you need to specify

So how do I set the name value for media when I upload a file in curl?


  
   'media','media'=>'@E:\WWW\6\0604\1.jpg')    );    $data=curl_exec($ch);    curl_close($ch);    echo $data;?>  

Reply content:

In HTML uploads, you need to specify

So how do I set the name value for media when I upload a file in curl?


  
   'media','media'=>'@E:\WWW\6\0604\1.jpg')    );    $data=curl_exec($ch);    curl_close($ch);    echo $data;?>  

curl_setopt($ch, CURLOPT_POSTFIELDS, array('media'=>'@E:\WWW\6\0604\1.jpg'));

Equivalent to

The key ' media ' in the array is actually the name in input

I am registered an account, come in to give you a praise!!! Thank you

Study, it's really not used.

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