CURL: Send images with boundary to REST API

后端 未结 2 1480
南笙
南笙 2021-01-21 07:04

Im currently working with some kind of API. I have wrote simple functions which allows me to add new content, however Im stuck on uploading images.

Here\'s simple CURL c

2条回答
  •  無奈伤痛
    2021-01-21 07:51

    I have the same problem and found a solution but only for single images. The trick is that your array MUST look like these:

    $images = array(
      'image' => 'PATH/IMG.jpg',
    );
    

    That means that the the key must be "image" and nothing other! I hope that helps ;)

提交回复
热议问题