无法移动图像文件

时间:2016-12-12 18:46:00

标签: google-api google-drive-api

我使用该方法将文件移动到Google云端硬盘中的另一个文件夹。但我只能使用该方法移动html文件。我该如何解决这个问题?

function moveFile(parentId, fileId) {
        var body = {'id': fileId};
        body.parents = [{'id': parentId}];

        var request = gapi.client.request({
            'path': 'drive/v2/files/' + fileId,
            'method': 'PUT',
            'body': body
        });
        request.execute(function (resp) {

        });
    }

1 个答案:

答案 0 :(得分:1)

在我添加了一些其他范围后,它可以正常工作。

var scopes = ['profile', 'https://www.googleapis.com/auth/drive','https://www.googleapis.com/auth/drive.file' , 'https://www.googleapis.com/auth/drive.metadata'
        , 'https://www.googleapis.com/auth/drive.appdata', 'https://www.googleapis.com/auth/drive.scripts'];