I'm having problems posting images to https://www.googleapis.com/upload/drive/v3/files?uploadType=media. The file is created on my Google Drive, however the jpeg is always 35KB is size, so appears none of the image content ever gets uploaded.
Originally I thought it was bug in vue-google-api however now suspect it's something with the Google Drive API V3. When I try posting an image directly to the API, I experience the same problem.
Request
POST https://www.googleapis.com/upload/drive/v3/files?uploadType=media
Accept: */*
Accept-Encoding: gzip, deflate
Content-Type: image/jpeg
Content-Length: 26837
Accept-Language: en-ca
Authorization: Bearer ya29.Gl1pB5BN9khs33ygA9pnIbyxJYp87teqDUfm55EsEHmmPJz0...
/9j/4AAQSkZJRgABAQEASABIAAD//gAMQXBwbGVNYXJrCv/bAIQABwUFBgUFBwYGBggHBwgKEQs...
Response
HTTP/1.1 200 OK
Server: UploadServer
Content-Type: application/json; charset=UTF-8
X-GUploader-UploadID: AEnB2UrjBAKhEMI-rCdzXpfAF3rM3oBABNUVH9AnhFtoXsoRroYV3By4rVqEuU1mn_5rJ2u_msN99Z1m2r-6Lh53fAowxmQ7QGAgWr2bP6cEwfnfV9JE-Vc
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Vary: Origin, X-Origin
Date: Mon, 19 Aug 2019 17:04:18 GMT
Alt-Svc: quic=":443"; ma=2592000; v="46,43,39"
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Length: 118
{
"kind": "drive#file",
"id": "16dC3Fv2vKIur426INggTZ6GzDvyRUPrV",
"name": "Untitled",
"mimeType": "image/jpeg"
}
Has anyone been able to successfully upload images to Google Drive API V3? Any idea what could be going wrong?
base64
string, then calculating theContent-Length
usingparseInt(base64.replace(/=/g,"").length * 0.75)
. Does this look correct? – Dale Zak