久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Google Drive API JavaScript - 插入文件

Google Drive API JavaScript - Insert file(Google Drive API JavaScript - 插入文件)
本文介紹了Google Drive API JavaScript - 插入文件的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我正在嘗試插入"一個(gè)云端硬盤(pán)文件.我已經(jīng)進(jìn)行了身份驗(yàn)證,它工作正常:)

I'm trying to "insert" a Drive file. I've made the auth and it works right :)

但是當(dāng)我嘗試從 JS 創(chuàng)建(插入)一個(gè)新文件時(shí),它會(huì)創(chuàng)建一個(gè)名為Untitled"的文件,根本沒(méi)有擴(kuò)展名.(我的文件系統(tǒng)上有一個(gè)同步文件夾,也是一樣的).

But when I try to create (insert) a new file from JS, it creates one, but a file named "Untitled" with no extension at all. (I have a sync folder on my file system, and it is the same thing).

我的代碼是這樣的:

 function createNewFile(  ) {
    gapi.client.load('drive', 'v2', function() {
    var request = gapi.client.drive.files.insert ( {
        "title" : "cat.jpg",
        "mimeType" : "image/jpeg",
        "description" : "Some"
        } );
    request.execute(function(resp) { console.log(resp); });
    });
 }

知道什么是錯(cuò)的嗎?我可以從 JS 的驅(qū)動(dòng)器中列出文件,這段代碼創(chuàng)建了這個(gè)無(wú)標(biāo)題"并且沒(méi)有擴(kuò)展文件.

Any idea about what is wrong? I can list files from my drive from JS, and this code creates this "untitled" and no extensioned file.

推薦答案

我有這樣的工作:

function createNewFile(  ) {

    gapi.client.load('drive', 'v2', function() {

       var request = gapi.client.request({
        'path': '/drive/v2/files',
        'method': 'POST',
        'body':{
            "title" : "cat.jpg",
            "mimeType" : "image/jpeg",
            "description" : "Some"
         }
     });

      request.execute(function(resp) { console.log(resp); });
   });
}

請(qǐng)注意,如果標(biāo)題為 cat.jpg 的文件已存在,則此請(qǐng)求將創(chuàng)建另一個(gè)具有相同標(biāo)題的文件,因?yàn)?Google 云端硬盤(pán)中的文件具有唯一的文件 ID,內(nèi)部引用這些文件 ID.

Bear in mind that if a file with title cat.jpg already exists, this request will create another file with the same title, since files in Google Drive have unique file IDs by which are referred internally.

這篇關(guān)于Google Drive API JavaScript - 插入文件的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機(jī)器人提及發(fā)出該機(jī)器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復(fù)必須使用導(dǎo)入來(lái)加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來(lái)自特定服務(wù)器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復(fù)“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務(wù)器時(shí)的歡迎消息)
主站蜘蛛池模板: 97久久久久久久久 | 国产精品久久777777 | 中文字幕91 | 亚洲人成网站777色婷婷 | 在线播放国产一区二区三区 | 日本h片在线观看 | 免费激情| 91看片视频 | 日本一区二区三区在线观看 | 日韩av免费在线观看 | 91精品国产91久久久久久吃药 | 精品久久久久一区二区国产 | 成人欧美日韩一区二区三区 | 国产黄色小视频在线观看 | 久久lu | 国产黄色小视频在线观看 | 国产高清亚洲 | 国产日产精品一区二区三区四区 | 成人午夜高清 | 欧美日韩国产中文 | 九九精品久久久 | 久久中文字幕电影 | 91久久国产综合久久 | 久久久美女 | 国产欧美一区二区三区在线播放 | 亚洲一区久久 | 亚洲一区免费在线 | 国产精品久久久久久久久久三级 | 国产成人精品免费视频 | 黄色成人在线 | 国产精品一区二区久久久久 | 欧美中文一区 | 狠狠骚 | 一区二区三区国产 | 日韩视频精品 | 国产成人免费视频网站视频社区 | 在线观看亚洲专区 | 99re | 亚洲欧美视频一区 | 亚洲精品大全 | 九九久久久久久 |