Google云端硬盘网站上传失败上传HTTP错误(6)

时间:2014-07-01 18:38:16

标签: html google-drive-api

我正在尝试创建一个网站,将文件从我的网站上传到Google云端硬盘,但我遇到了很多麻烦。 我使用过这段代码:

<!DOCTYPE html>

<html>
  <head>
    <title>Save to Drive Demo: Explicit Render</title>
    <link rel="canonical" href="http://samrobbins.125mb.com/googledrive.html">
    <script src="https://apis.google.com/js/platform.js">
      {parsetags: 'explicit'}
    </script>
  </head>
  <body>
    <a href="javascript:void(0)" id="render-link">Render the Save to Drive button</a>
    <div id="savetodrive-div"></div>
    <script>
      function renderSaveToDrive() {
        gapi.savetodrive.render('savetodrive-div', {
                src: 'http://samrobbins.125mb.com/knowledgebase.py',
          filename: 'Cat.py',
          sitename: 'The electronic cat database'
        });
      }
      document.getElementById('render-link').addEventListener('click', renderSaveToDrive);
    </script>
  </body>
</html>

但是当我加载它时,它表示有Failed Upload HTTP error (6)

有没有办法阻止这个?

1 个答案:

答案 0 :(得分:0)

http错误6无法解析主机名。您的服务器可能已关闭或data-src服务器可能已关闭。稍后再试。

您正在使用Google驱动器进行分享。谷歌驱动器doc的默认可见性是私有的。您应该将其更改为公开。

选中文件/文件夹旁边的框,然后点击文件列表顶部的“分享”按钮