Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

javascript - Google Drive uploading file size limit

Im trying to upload my files to Google Drive via REST API (resumable upload). Everything looks good (XMLHttpRequest triggers onprogress and onload events), but after it (onload triggered) Google Drive PUT request fail with 500 Internal Server Error. File not appears in my Google Drive folder. Error 500 comes in xhr.onload, not in xhr.onerror.

Same thing if im trying to upload that file via Google Drive interface. It happens sometimes, and i haven't environment with 100% reproducing.

Filetype Adobe .DNG or Canon .CR2 and filesize ~28MB.

What im doing wrong? Is it known bug or limitations to filetypes or file?

Possible reasons: filesize limitations, filetype limitations, or maybe my token is expires while my file is uploading?

UPD: Im using this uploader as is, only with cosmetic changes.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

OK. I got it.

Files uploads successfully with Content-Type == "application/octet-stream". Looks like bug on GoogleDrive side with mime-type'd files. In this scenario my raw files (DNG, CR2, NEF etc.) stores in GoogleDrive with incorrect mime-type (as a result there is no preview for these files).

So i can't filter files by mime-type anymore.

Query string = (mimeType = 'image/x-adobe-dng' or mimeType = 'image/x-canon-cr2' or mimeType = 'image/x-nikon-nef').

I tried to filter files by keyword title, but looks like titles doesn't contain extension, but in response item titles contain extension.

Query string = (title contains '.dng' or title contains '.cr2' or title contains '.nef').

So i have to filter my files not by mime-type or by title, but by fullText keyword.

Query string = (fullText contains '.dng' or fullText contains '.cr2' or fullText contains '.nef').

Conclusion:

  1. GoogleDrive uploader checks Content-Type, even if convert option is set to false.
  2. GoogleDrive fails from time to time with this convertation.
  3. Uploader works fine with Content-Type == 'application/octet-stream'.
  4. GoogleDrive query string keyword title doesn't contain file extension, but in response titles have extension.
  5. GoogleDrive query string keyword fullText contains filename with extension (mb its not very fast for text files).
  6. To test your request you can use this tool https://developers.google.com/drive/v2/reference/files/list in the end of page.
  7. GoogleDrive API crashes from time to time with HTTP status 500 Internal Server Error:

{"error":{"errors":[{"domain":"global","reason":"backendError","message":"Backend Error"}],"code": 500,"message": "Backend Error"}}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...