使用HTTP API将文件上传到Google云端硬盘时,如何指定文件名? [英] How to specify the file name while uploading a file to Google Drive using the HTTP API?

查看:57
本文介绍了使用HTTP API将文件上传到Google云端硬盘时,如何指定文件名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HTTP API将文件上传到Google云端硬盘:

I'm uploading files to Google Drive using the HTTP API:

https://developers.google.com/drive/manage-uploads

我正在将文件内容发布到https://www.googleapis.com/upload/drive/v2/files,并且工作正常.

I'm posting the file content to https://www.googleapis.com/upload/drive/v2/files and it's working fine.

但是,我在任何地方都找不到如何指定文件名.有什么主意吗?

However, I can't find anywhere how to specify the file name. Any idea?

推荐答案

您应将文件元数据与文件内容一起发送,并设置title属性以指定文件名:

You should send the file metadata together with the file content and set the title property to specify the file name:

{
  "title": "My File"
}

这篇关于使用HTTP API将文件上传到Google云端硬盘时,如何指定文件名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆