【问题标题】:Google Drive API File Insert DocxGoogle Drive API 文件插入 Docx
【发布时间】:2015-04-14 10:20:15
【问题描述】:

我正在使用 Google Drive API 上传文件。当我上传 Doc 或 Docx 文件时它正在工作。但是,我无法在 Google Drive 界面中打开上传的 Docx 文件。

这是我的电话

$result = $service->files->insert(
    $file,
        array(
            'data'       => $data,
            'mimeType'   => 'application/octet-stream',
            'uploadType' => 'multipart',
            'convert'    => true
        )
    );      

无论我设置转换为真还是假。我发现 docx 文件无法转换。我该如何解决?

【问题讨论】:

    标签: google-drive-api docx


    【解决方案1】:

    将文件上传到 Google 云端硬盘后,转到 Settings 并选中显示为:Convert the uploaded files to Google Docs editor format 的复选框。这允许我编辑 docx 文件。

    查看此页面了解更多信息:https://productforums.google.com/forum/#!topic/docs/0l3HJhqhNGs

    希望有帮助!

    【讨论】:

      【解决方案2】:

      我发现 Docx 的 mimeType 应该是“application/vnd.openxmlformats-officedocument.wordprocessingml.document”。它会自动将文件转换为google doc格式。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-01-13
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多