簡體   English   中英

如何設置Google Drive下載文件的位置?

[英]how can I set google drive download file's location?

驅動器下載已在ajax中工作,但我找不到我的文件

我試過了

//      driveService.files()
//        .export(fileId, "application/vnd.openxmlformats officedocument.wordprocessingml.document")
//        .executeMediaAndDownloadTo(outputStream);

但仍然找不到我的文件

        @Override
        public int downloadFile(HttpSession session, String fileId) throws IOException {
            // TODO Auto-generated method stub
            Drive driveService = getCredential(session);
            OutputStream outputStream = new ByteArrayOutputStream();
        driveService.files().get(fileId).executeMediaAndDownloadTo(outputStream);

    //      driveService.files()
    //        .export(fileId, "application/vnd.openxmlformats-officedocument.wordprocessingml.document")
    //        .executeMediaAndDownloadTo(outputStream);
            return 0;
        }

ajax成功並且方法運行沒有問題,但是找不到下載的文件

您已經創建了一個OutputStream,其中包含文件的內容。 但是,您對此無能為力。 您需要使用該OutputStream並將其自己寫入本地文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM