Upload a file using an API PUT request

后端 未结 1 1327
时光说笑
时光说笑 2020-12-25 13:39

I\'m building an API in PHP. One of the methods is place.new (PUT request). It expects several string fields, and it also expects an image. However I can\'t get it working.

相关标签:
1条回答
  • 2020-12-25 14:06

    Did you read http://php.net/manual/en/features.file-upload.put-method.php ? Script PUT /put.php all set up?

    Also, what is $image -- it needs to be a file handler, not a file name.

    Ps. Using file_get_contents will try to load whatever is PUT on the server into memory. Not a good idea. See the linked manual page.

    0 讨论(0)
提交回复
热议问题