简体   繁体   中英

How send file using PHP and Curl

如何使用PHP和Curl执行此类请求?

curl -v  -X POST  --data-binary @"myJpegFile.jpg" http://bol.cinovatech.com /newcrunch/1441749032/MmRhMmYwYzk4OWY2Y2IyNzNlNTU1MmMwOTUyNTE5YzY4YjJiOTIxNg==   > outPutFile.jpg

Try this code for send file :-

curl_setopt(
    $request,
    CURLOPT_POSTFIELDS,
    array(
      'file' =>
          '@'            . $_FILES['file']['tmp_name']
          . ';filename=' . $_FILES['file']['name']
          . ';type='     . $_FILES['file']['type']
    ));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM