PHP Google Drive API - 仅将文件上传为“无标题” - 文件或仅包含内容 [英] PHP Google Drive API - File Upload Only As "Untitled"-File Or Just Without Content

查看:107
本文介绍了PHP Google Drive API - 仅将文件上传为“无标题” - 文件或仅包含内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找解决方案,通过PHP将我的根服务器上的文件直接上传到我的Google Drive-帐户。



授权工作正常,但是当我尝试要传输文件(例如test.jpg),它只会在Google云端硬盘中创建一个名为无标题的文件。它也忽略了保存它的文件夹并在主文件夹中创建它。



如果我使用相同的保存函数,使用相同的参数,但只是将文件内容清空一切正常。在正确的子文件夹中创建了文件 - 我想要的所有东西 - 但没有filedata。



这可能是配置问题吗?



我使用下面的代码(请参阅底部的php-example)传输文件:
https://developers.google.com/drive/v2/reference/files/update



非常感谢您的回答!! 解决方案

相当: https://developers.google.com/drive/v2/reference/files/insert ...用于创建新文件



方法update提供了创建新版本或覆盖现有文件的功能。 b $ b

I am searching for a solution to upload files from my root server directly to my Google Drive-account via PHP.

Authorisation is working fine, but when I try to transfer a file (for example "test.jpg"), it just creates a file named "Untitled" in Google Drive. It also ignores the folder where to save it in and creates it in the main-folder.

If I use the same save-function, with the same parameters, but just leave the file-content empty everything works fine. The file gets created with the correct filename in the correct subfolder - everything I want - but without the filedata.

Is it perhaps a configuration-problem?

I am using the following code (see the php-example at the bottom) for transfering the files: https://developers.google.com/drive/v2/reference/files/update

Many thanks for your answers!!

解决方案

It's rather: https://developers.google.com/drive/v2/reference/files/insert ... for creating new files.

Method "update" provides functionality for creating new revisions or overwriting existing files.

这篇关于PHP Google Drive API - 仅将文件上传为“无标题” - 文件或仅包含内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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