Curl High-Low version transfer file

Source: Internet
Author: User
These days because you want to call the Java interface so to transfer files I chose the curl file, this side said a pit, I was in the file transfer time with the original @ behind directly plus the file absolute path.

However, there has been no error in the feeling has not been sent out, and then I used the win under the test, directly throw a warning that this method is outdated, please use the Curlfile function instead. Until now I know that the original is their own computer has not opened a warning error, win under I have been open, this problem for a long time.

Here's the code to see Curl transfer files and array data,

  $beforePath = '/applications/mamp/htdocs/photo/1.jpg ';         $afterPath = '/applications/mamp/htdocs/photo/2.jpg ';//absolute path        $data = [                                ' top ' + = Curl_file_create ($ Beforepath),                ' after ' = Curl_file_create ($afterPath),                ' partnerid ' and ' = ' $data [' 0 '] [' uid '],                ' mobile ' = = $data 1[' 0 ' [' phone '],                ' email ' and ' $data 1[' 0 ' [' email '],                ' realname ' + $data [' 0 '] [' real_name '],                        ];        curl_setopt ($ch, Curlopt_ssl_verifyhost, FALSE); Disable Certificate        curl_setopt ($ch, Curlopt_ssl_verifypeer, FALSE);        curl_setopt ($ch, Curlopt_header, false);                    curl_setopt ($ch, Curlopt_post, true);          curl_setopt ($ch, curlopt_binarytransfer,true);        curl_setopt ($ch, Curlopt_postfields, $data);        curl_setopt ($ch, Curlopt_url, $url);        $info = curl_exec ($ch);        Curl_close ($ch);

The above describes the curl high-low version of the transfer file, including the content, I hope that the PHP tutorial interested in a friend helpful.

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