cURL upload to Google Drive

人盡茶涼 提交于 2019-12-04 07:41:21

You want to put the file in the body (i.e. in the CURLOPT_POSTFIELDS). You'll want to specify Content-Type matching the file type and Content-Length as well.

This is well documented.

File metadata should be going to /drive/v2/files, not /upload/drive/v2/files.

This way, you'd have to make two requests.

If you want to do both a file and meta simultaneously, you can use the API and file insert:

https://developers.google.com/drive/v2/reference/files/insert

Note that there's a PHP library to make this easier.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!