OAuth 2.0 Playground - Upload Image - POST - How to name file

737 views Asked by At

HTTP Method: POST

Request URI: https://www.googleapis.com/upload/drive/v2/files

Here is the request info generated by the Playground:

POST /upload/drive/v2/files HTTP/1.1
Host: www.googleapis.com
Uploadmypic: image/jpeg
Content-length: 92818
Content-type: image/jpeg
Authorization: Bearer ya29.1.LongKeyHereThatIveReplaceWithThis

A .jpg file was read from my hard drive, then saved to my Google Drive. The file saved to my Google Drive had no name. Name=Untitled

How do I create a file with a name, rather than 'untitled'?

1

There are 1 answers

0
pinoyyid On BEST ANSWER

You need to provide a File resource as the body of the POST request. The File resource contains a title property which is the file name. If you try https://developers.google.com/drive/v2/reference/files/insert#try-it you will see the precise format.