我正在尝试使用 google api 驱动器上传演示文稿,但演示文稿不完整,有些幻灯片是空白的,正在查看日志,这就是显示的内容
com.google.api.client.http.HttpRequest execute: -------------- REQUEST --------------
PUT https://www.googleapis.com/upload/drive/v2/files? uploadType=resumable&upload_id=AEnB2UrDPJgLIehcqH--aWgwl- R_atDhqdvbXnJiWMXKE0V0euJGOvULbM4y5YmvUePWaHSrYyFdOgsmTASJGe-Dtvg09NCkzQ
Accept-Encoding: gzip
Authorization: Bearer ya29.AHES6ZTfSaK77NGCcZO1bK_aTbT8zVX3eslOAb8BkrvpeXARK94XsXY
Content-Range: bytes 0-1048575/6774302
User-Agent: Google-HTTP-Java-Client/1.11.0-beta (gzip)
Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation
Content-Length: 1048576
com.google.api.client.http.HttpRequest execute: curl -v --compressed -X PUT -H 'Accept- Encoding: gzip' -H 'Authorization: Bearer ya29.AHES6ZTfSaK77NGCcZO1bK_aTbT8zVX3eslOAb8BkrvpeXARK94XsXY' -H 'Content-Range: bytes 0- 1048575/6774302' -H 'User-Agent: Google-HTTP-Java-Client/1.11.0-beta (gzip)' -H 'Content-Type: application/vnd.openxmlformats-officedocument.presentationml.presentation' -d '@-' -- https://www.googleapis.com/upload/drive/v2/files? uploadType=resumable&upload_id=AEnB2UrDPJgLIehcqH--aWgwl- R_atDhqdvbXnJiWMXKE0V0euJGOvULbM4y5YmvUePWaHSrYyFdOgsmTASJGe-Dtvg09NCkzQ << $$$
com.google.api.client.http.HttpResponse <init>: -------------- RESPONSE --------------
308 OK
server: HTTP Upload Server Built on Oct 3 2012 16:52:30 (1349308350)
range: bytes=0-1048575
x-range-md5: 19230c1c1a0fc493f3431f46cf30c14c
date: Mon, 05 Nov 2012 22:00:33 GMT
pragma: no-cache
expires: Fri, 01 Jan 1990 00:00:00 GMT
cache-control: no-cache, no-store, must-revalidate
content-length: 0
content-type: text/html; charset=UTF-8
x-google-cache-control: remote-fetch
via: HTTP/1.1 GWA
这是正在使用的代码:
byte[] myFile = readImageData(blobKey,size);
ByteArrayContent mediaContent = new ByteArrayContent(mimeType, myFile);
Drive.Files.Insert insert = service.files().insert(body, mediaContent);
insert.getMediaHttpUploader().setChunkSize(1024 * 1024);
File file = insert.execute();
更新
做一些测试,似乎只有在上传扩展名为 .pptx 的演示文稿时才会出现错误
该扩展的 mimeType 有什么问题吗?
我希望有人可以帮助我,谢谢。