Java 谷歌硬盘文件上传转换成文档

Java 谷歌硬盘文件上传转换成文档,java,file-upload,google-drive-api,file-conversion,Java,File Upload,Google Drive Api,File Conversion,我正在使用GoogleDriveV3RESTAPI从POST请求上传一个多部分文件&下面是java代码 String accessToken = "xyz"; Credential credential = new GoogleCredential().setAccessToken(accessToken); Drive service = new Drive.Builder(HTTP

我正在使用GoogleDriveV3RESTAPI从POST请求上传一个多部分文件&下面是java代码

                String accessToken = "xyz";
                    Credential credential = new GoogleCredential().setAccessToken(accessToken);
                    Drive service = new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential)
                            .setApplicationName("xyz")
                            .build();
                File fileMeta = new File();
                fileMeta.setName(fileName);
                fileMeta.setMimeType("application/vnd.google-apps.file");
                if (!parentFolderId.isEmpty()) {
                    fileMeta.setParents(Collections.singletonList(parentFolderId));
                }
                //Code to upload file in GDrive
                java.io.File tmpFile = java.io.File.createTempFile("uploadFile", ".tmp");

                //Writing the file content to the new file
                InputStream in = multipartFile.getInputStream();
                FileOutputStream fos = new FileOutputStream(tmpFile);

                IOUtils.copy(in, fos);

                in.close();
                fos.close();

                tmpFile.deleteOnExit();
                FileContent mediaContent = new FileContent(null, tmpFile);
                File file = service.files().create(fileMeta, mediaContent)
                        .setFields("id")
                        .execute();
上传工作正常,但所有上传都自动转换成我不想要的文档。我从问题中看出,在插入过程中需要设置convert=true。但此选项在V3中不可用


有人能告诉我如何在上传过程中禁用此自动转换吗?

自动转换的原因是因为在文件对象中设置了mime类型,因为每个上传的文件都被转换为google文档

fileMeta.setMimeType("application/vnd.google-apps.file");
上传时,如果文件对象中未设置mimeType,则此问题得到解决