简体   繁体   中英

save byte[] to Google Drive from AppEngine Java

byte[] fileItemData = blobstoreService.fetchData(blobKey, 0, 999999);   
ByteArrayContent mediaContent = new ByteArrayContent(fileItemMimeType, fileItemData);
insert = driveService.files().insert(body, mediaContent);
File file = insert.execute();

-> why does the insert.execute() not catch Exception...? just does nothing. -> when i leave the "fileItemData" i get an item in google drive. So what is wrong with it? I am trying to upload to Google AppEngine and store to Google Drive on AppEngine.

Could you try your code with a smaller data, for instance this:

ByteArrayContent mediaContent = ByteArrayContent.fromString("text/plain", "Hello World")
driveService.files().insert(body, mediaContent).execute();

and let me know if that works...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM